Sha256: cc93168b4bb5fdad6659b0c605b1d04cb2d133ce4a899b10b03222c9b59a71b7

Contents?: true

Size: 1.18 KB

Versions: 24

Compression:

Stored size: 1.18 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2011 Strobe Inc. and contributors.
//            Portions ©2008-2011 Apple Inc. All rights reserved.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================

SC.mixin(SC.browser,
/** @scope SC.browser */ {

  /**
    Pass any number of arguments, and this will check them against the browser
    version split on ".".  If any of them are not equal, return the inequality.
    If as many arguments as were passed in are equal, return 0.  If something
    is NaN, return 0.
  */
  compareVersion: function () {
    if (this._versionSplit === undefined) {
      var coerce = function (part) {
        return Number(part.match(/^[0-9]+/));
      };
      this._versionSplit = SC.A(this.version.split('.')).map(coerce);
    }

    var tests = SC.A(arguments).map(Number);
    for (var i = 0; i < tests.length; i++) {
      var check = this._versionSplit[i] - tests[i];
      if (isNaN(check)) return 0;
      if (check !== 0) return check;
    }
    
    return 0;
  }

});

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
sproutcore-1.7.1.beta-java lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.7.1.beta lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.6.0.1-java lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.6.0.1 lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.6.0.1-x86-mingw32 lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.6.0 lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.6.0-java lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.6.0.rc.2-x86-mingw32 lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.6.0.rc.2 lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.6.0.rc.2-java lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.6.0.rc.1-x86-mingw32 lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.6.0.rc.1 lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.6.0.rc.1-java lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.6.0.beta.3-x86-mingw32 lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.6.0.beta.3-java lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.6.0.beta.3 lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.6.0.beta.2-x86-mingw32 lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.6.0.beta.2-java lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.6.0.beta.2 lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js
sproutcore-1.6.0.beta.1 lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js