diff --git a/lodash.js b/lodash.js index 84c14da22..b8afb9522 100644 --- a/lodash.js +++ b/lodash.js @@ -398,7 +398,7 @@ var index = -1, length = string.length; - while (++index < length && chars.indexOf(string.charAt(index)) > -1) { } + while (++index < length && chars.indexOf(string.charAt(index)) > -1) {} return index; } @@ -414,7 +414,7 @@ function charsRightIndex(string, chars) { var index = string.length; - while (index-- && chars.indexOf(string.charAt(index)) > -1) { } + while (index-- && chars.indexOf(string.charAt(index)) > -1) {} return index; } @@ -556,7 +556,7 @@ var index = -1, length = string.length; - while (++index < length && isWhitespace(string.charCodeAt(index))) { } + while (++index < length && isWhitespace(string.charCodeAt(index))) {} return index; } @@ -571,7 +571,7 @@ function trimmedRightIndex(string) { var index = string.length; - while (index-- && isWhitespace(string.charCodeAt(index))) { } + while (index-- && isWhitespace(string.charCodeAt(index))) {} return index; } @@ -682,7 +682,7 @@ try { var func = isNative(func = context.Float64Array) && func, result = new func(new ArrayBuffer(10), 0, 1) && func; - } catch(e) { } + } catch(e) {} return result; }()); @@ -693,7 +693,7 @@ var o = {}, func = isNative(func = Object.defineProperty) && func, result = func(o, o, o) && func; - } catch(e) { } + } catch(e) {} return result; }()); @@ -852,8 +852,8 @@ Ctor.prototype = { 'valueOf': 1, 'y': 1 }; for (var key in new Ctor) { props.push(key); } - for (var argsKey in arguments) { } - for (var strKey in 'x') { } + for (var argsKey in arguments) {} + for (var strKey in 'x') {} /** * Detect if the `[[Class]]` of `arguments` objects is resolvable @@ -3315,7 +3315,7 @@ index = length; predicate = getCallback(predicate, thisArg, 3); - while (index-- && predicate(array[index], index, array)) { } + while (index-- && predicate(array[index], index, array)) {} return slice(array, 0, index + 1); } @@ -3364,7 +3364,7 @@ length = array ? array.length : 0; predicate = getCallback(predicate, thisArg, 3); - while (++index < length && predicate(array[index], index, array)) { } + while (++index < length && predicate(array[index], index, array)) {} return slice(array, index); } @@ -4076,7 +4076,7 @@ index = length; predicate = getCallback(predicate, thisArg, 3); - while (index-- && predicate(array[index], index, array)) { } + while (index-- && predicate(array[index], index, array)) {} return slice(array, index + 1); } @@ -4125,7 +4125,7 @@ length = array ? array.length : 0; predicate = getCallback(predicate, thisArg, 3); - while (++index < length && predicate(array[index], index, array)) { } + while (++index < length && predicate(array[index], index, array)) {} return slice(array, 0, index); } diff --git a/perf/index.html b/perf/index.html index 9f3e6c717..a379d5f49 100644 --- a/perf/index.html +++ b/perf/index.html @@ -69,7 +69,7 @@ // is the applet permitted? if (!/[?&]nojava=true(?:&|$)/.test(location.search)) { // is the applet really needed? - while (!(measured = new Date - begin)) { } + while (!(measured = new Date - begin)) {} if (measured != 1 && !((perfNow = window.performance) && typeof (perfNow.now || perfNow.webkitNow) == 'function')) { // load applet document.write(''); @@ -79,4 +79,4 @@ }()); - \ No newline at end of file + diff --git a/perf/perf.js b/perf/perf.js index 651d3b3df..f5f8841b4 100644 --- a/perf/perf.js +++ b/perf/perf.js @@ -43,11 +43,11 @@ if (!amd) { try { result = require('fs').realpathSync(result); - } catch(e) { } + } catch(e) {} try { result = require.resolve(result); - } catch(e) { } + } catch(e) {} } return result; }()); diff --git a/test/index.html b/test/index.html index 4648cf5ab..598d3a9c0 100644 --- a/test/index.html +++ b/test/index.html @@ -54,6 +54,7 @@ var hasOwnProperty = objectProto.hasOwnProperty, fnToString = funcProto.toString, nativeString = fnToString.call(objectProto.toString), + noop = function() {}, propertyIsEnumerable = objectProto.propertyIsEnumerable, reToString = /toString/g, whitespace = ' \t\x0B\f\xA0\ufeff\n\r\u2028\u2029\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'; @@ -78,26 +79,26 @@ }())); // add extensions - funcProto._method = function() {}; + funcProto._method = noop; // set bad shims setProperty(Array, '_isArray', Array.isArray); - setProperty(Array, 'isArray', function() {}); + setProperty(Array, 'isArray', noop); setProperty(Date, '_now', Date.now); - setProperty(Date, 'now', function() {}); + setProperty(Date, 'now', noop); setProperty(Object, '_create', Object.create); - setProperty(Object, 'create', function() {}); + setProperty(Object, 'create', noop); setProperty(Object, '_defineProperty', Object.defineProperty); - setProperty(Object, 'defineProperty', function() {}); + setProperty(Object, 'defineProperty', noop); setProperty(Object, '_getPrototypeOf', Object.getPrototypeOf); - setProperty(Object, 'getPrototypeOf', function() {}); + setProperty(Object, 'getPrototypeOf', noop); setProperty(Object, '_keys', Object.keys); - setProperty(Object, 'keys', function() {}); + setProperty(Object, 'keys', noop); setProperty(objectProto, 'hasOwnProperty', (function() { function wrapper(key) { @@ -114,13 +115,13 @@ }())); setProperty(Number, '_isFinite', Number.isFinite); - setProperty(Number, 'isFinite', function() {}); + setProperty(Number, 'isFinite', noop); setProperty(stringProto, '_contains', stringProto.contains); - setProperty(stringProto, 'contains', stringProto._contains ? function() {} : Boolean); + setProperty(stringProto, 'contains', stringProto._contains ? noop : Boolean); setProperty(document, '_createDocumentFragment', document.createDocumentFragment); - document.createDocumentFragment = function() {}; + document.createDocumentFragment = noop; setProperty(window, '_ArrayBuffer', window.ArrayBuffer); if (window.ArrayBuffer && window.Uint8Array) { diff --git a/test/test.js b/test/test.js index 612d7e1b8..e77cb4c0c 100644 --- a/test/test.js +++ b/test/test.js @@ -62,11 +62,11 @@ if (!amd) { try { result = require('fs').realpathSync(result); - } catch(e) { } + } catch(e) {} try { result = require.resolve(result); - } catch(e) { } + } catch(e) {} } return result; }()); @@ -107,7 +107,7 @@ /** Used to test host objects in IE */ try { var xml = new ActiveXObject('Microsoft.XMLDOM'); - } catch(e) { } + } catch(e) {} /** Use a single "load" function */ var load = (typeof require == 'function' && !amd) @@ -212,7 +212,7 @@ var o = {}, func = Object.defineProperty, result = func(o, o, o) && func; - } catch(e) { } + } catch(e) {} return result; }()); @@ -992,7 +992,7 @@ try { var bound = _.bind(fn, value); return bound(); - } catch(e) { } + } catch(e) {} }); ok(_.every(actual, function(value, index) { @@ -1531,8 +1531,8 @@ test('`_.cloneDeep` should deep clone objects with circular references', 1, function() { var object = { - 'foo': { 'b': { 'foo': { 'c': { } } } }, - 'bar': { } + 'foo': { 'b': { 'foo': { 'c': {} } } }, + 'bar': {} }; object.foo.b.foo.c = object; @@ -2025,7 +2025,7 @@ }); test('should accept a falsey `prototype` argument', 1, function() { - var expected = _.map(falsey, function() { return {}; }); + var expected = _.map(falsey, _.constant({})); var actual = _.map(falsey, function(value, index) { return index ? _.create(value) : _.create(); @@ -3212,7 +3212,7 @@ var actual = _.map(empties, function(value) { try { return _.every(value, _.identity); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -3360,7 +3360,7 @@ _.each(emptyValues, function(value) { try { actual.push(func(value, { 'a': 3 })); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expecting); @@ -4726,7 +4726,7 @@ var actual = _.map(falsey, function(value, index) { try { return index ? _.initial(value) : _.initial(); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -5465,12 +5465,12 @@ test('should perform comparisons between objects with complex circular references', 1, function() { var object1 = { - 'foo': { 'b': { 'foo': { 'c': { } } } }, + 'foo': { 'b': { 'foo': { 'c': {} } } }, 'bar': { 'a': 2 } }; var object2 = { - 'foo': { 'b': { 'foo': { 'c': { } } } }, + 'foo': { 'b': { 'foo': { 'c': {} } } }, 'bar': { 'a': 2 } }; @@ -6690,7 +6690,7 @@ var actual = _.map(falsey, function(value, index) { try { return index ? func(value) : func(); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -6779,7 +6779,7 @@ var actual = _.map(falsey, function(value, index) { try { return index ? _.map(value) : _.map(); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -6851,7 +6851,7 @@ var actual = _.map(falsey, function(value, index) { try { return index ? _.mapValues(value) : _.mapValues(); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -6951,7 +6951,7 @@ var actual = _.map(falsey, function(value, index) { try { return index ? matches(value) : matches(); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -6965,7 +6965,7 @@ try { var result = index ? matches(value) : matches(); return result === true; - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -7067,7 +7067,7 @@ var actual = _.map(empties, function(value) { try { return _.max(value); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -7080,7 +7080,7 @@ var actual = _.map(collections, function(value) { try { return _.max(value); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -7129,7 +7129,7 @@ var actual = _.map(falsey, function(value, index) { try { return _.isFunction(index ? _.memoize(_.noop, value) : _.memoize(_.noop)); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -7224,8 +7224,8 @@ }; var source = { - 'foo': { 'b': { 'foo': { 'c': { } } } }, - 'bar': { } + 'foo': { 'b': { 'foo': { 'c': {} } } }, + 'bar': {} }; source.foo.b.foo.c = source; @@ -7305,7 +7305,7 @@ var actual = _.map(empties, function(value) { try { return _.min(value); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -7318,7 +7318,7 @@ var actual = _.map(collections, function(value) { try { return _.min(value); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -8849,7 +8849,7 @@ _.each(empties, function(value) { try { actual.push(func(value, _.noop)); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -8861,7 +8861,7 @@ var actual = _.map(empties, function(value) { try { return func(value, _.noop, 'x'); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -9068,7 +9068,7 @@ var actual = _.map(falsey, function(value, index) { try { return index ? _.rest(value) : _.rest(); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -9188,7 +9188,7 @@ _.each(empties, function(value) { try { actual.push(_.shuffle(value), _.shuffle(value, 1)); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -9313,7 +9313,7 @@ var actual = _.map(falsey, function(value, index) { try { return index ? _.size(value) : _.size(); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -9449,7 +9449,7 @@ var actual = _.map(empties, function(value) { try { return _.some(value, _.identity); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -9932,7 +9932,7 @@ try { var actual = compiled(); - } catch(e) { } + } catch(e) {} strictEqual(actual, 'function'); }); @@ -10003,7 +10003,7 @@ 'interpolate': /\{\{=([\s\S]+?)\}\}/g }); - var compiled = _.template('', index ? null : settings), + var compiled = _.template('', index ? null : settings), expected = ''; strictEqual(compiled({ 'collection': ['a & A', 'b & B'] }), expected); @@ -10699,7 +10699,7 @@ try { var nodeList = document.getElementsByTagName('body'), actual = func(nodeList); - } catch(e) { } + } catch(e) {} deepEqual(actual, [body]); } @@ -11402,7 +11402,7 @@ var actual = _.map(falsey, function(value, index) { try { return index ? _.zipObject(value) : _.zipObject(); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -11663,7 +11663,7 @@ _.each(falsey, function(value, index) { try { actual.push(index ? func(value) : func()); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); @@ -11681,7 +11681,7 @@ var actual = _.map(falsey, function(value, index) { try { return func(value, 2); - } catch(e) { } + } catch(e) {} }); deepEqual(actual, expected); diff --git a/vendor/benchmark.js/benchmark.js b/vendor/benchmark.js/benchmark.js index d5727837d..e9dae4446 100644 --- a/vendor/benchmark.js/benchmark.js +++ b/vendor/benchmark.js/benchmark.js @@ -663,7 +663,7 @@ function req(id) { try { var result = freeExports && freeRequire(id); - } catch(e) { } + } catch(e) {} return result || null; } @@ -905,7 +905,7 @@ } else if (async) { // resume execution if previously asynchronous but now synchronous - while (execute()) { } + while (execute()) {} } else { // continue synchronous execution @@ -986,7 +986,7 @@ if (isAsync(bench)) { delay(bench, execute); } else { - while (execute()) { } + while (execute()) {} } } } @@ -1770,30 +1770,30 @@ divisor = 1e6; if (ns.stop) { ns.start(); - while (!(measured = ns.microseconds())) { } + while (!(measured = ns.microseconds())) {} } else { begin = ns(); - while (!(measured = ns() - begin)) { } + while (!(measured = ns() - begin)) {} } } else if (unit == 'ns') { divisor = 1e9; if (ns.nanoTime) { begin = ns.nanoTime(); - while (!(measured = ns.nanoTime() - begin)) { } + while (!(measured = ns.nanoTime() - begin)) {} } else { begin = (begin = ns())[0] + (begin[1] / divisor); - while (!(measured = ((measured = ns())[0] + (measured[1] / divisor)) - begin)) { } + while (!(measured = ((measured = ns())[0] + (measured[1] / divisor)) - begin)) {} divisor = 1; } } else if (ns.now) { begin = ns.now(); - while (!(measured = ns.now() - begin)) { } + while (!(measured = ns.now() - begin)) {} } else { begin = new ns().getTime(); - while (!(measured = new ns().getTime() - begin)) { } + while (!(measured = new ns().getTime() - begin)) {} } // check for broken timers (`nanoTime` may have issues) // http://alivebutsleepy.srnet.cz/unreliable-system-nanotime/ @@ -1828,7 +1828,7 @@ if (typeof timer.ns.nanoTime() == 'number') { timers.push({ 'ns': timer.ns, 'res': getRes('ns'), 'unit': 'ns' }); } - } catch(e) { } + } catch(e) {} // detect Chrome's microsecond timer: // enable benchmarking via the --enable-benchmarking command @@ -1837,7 +1837,7 @@ if ((timer.ns = new (context.chrome || context.chromium).Interval)) { timers.push({ 'ns': timer.ns, 'res': getRes('us'), 'unit': 'us' }); } - } catch(e) { } + } catch(e) {} // detect Node.js's nanosecond resolution timer available in Node.js >= 0.8 if (processObject && typeof (timer.ns = processObject.hrtime) == 'function') { diff --git a/vendor/platform.js/platform.js b/vendor/platform.js/platform.js index 5e8912471..498ef8f23 100644 --- a/vendor/platform.js/platform.js +++ b/vendor/platform.js/platform.js @@ -1,12 +1,12 @@ /*! - * Platform.js v1.1.0 + * Platform.js v1.2.0 * Copyright 2010-2014 John-David Dalton * Available under MIT license */ ;(function() { 'use strict'; - /** Used to determine if values are of the language type Object */ + /** Used to determine if values are of the language type `Object` */ var objectTypes = { 'function': true, 'object': true @@ -66,6 +66,60 @@ return string.charAt(0).toUpperCase() + string.slice(1); } + /** + * A utility function to clean up the OS name. + * + * @private + * @param {string} os The OS name to clean up. + * @param {string} [pattern] A `RegExp` pattern matching the OS name. + * @param {string} [label] A label for the OS. + */ + function cleanupOS(os, pattern, label) { + // platform tokens defined at + // http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx + // http://web.archive.org/web/20081122053950/http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx + var data = { + '6.3': '8.1', + '6.2': '8', + '6.1': 'Server 2008 R2 / 7', + '6.0': 'Server 2008 / Vista', + '5.2': 'Server 2003 / XP 64-bit', + '5.1': 'XP', + '5.01': '2000 SP1', + '5.0': '2000', + '4.0': 'NT', + '4.90': 'ME' + }; + // detect Windows version from platform tokens + if (pattern && label && /^Win/i.test(os) && + (data = data[0/*Opera 9.25 fix*/, /[\d.]+$/.exec(os)])) { + os = 'Windows ' + data; + } + // correct character case and cleanup + os = String(os); + + if (pattern && label) { + os = os.replace(RegExp(pattern, 'i'), label); + } + + os = format( + os.replace(/ ce$/i, ' CE') + .replace(/hpw/i, 'web') + .replace(/Macintosh/, 'Mac OS') + .replace(/_PowerPC/i, ' OS') + .replace(/(OS X) [^ \d]+/i, '$1') + .replace(/Mac (OS X)/, '$1') + .replace(/\/(\d)/, ' $1') + .replace(/_/g, '.') + .replace(/(?: BePC|[ .]*fc[ \d.]+)$/i, '') + .replace(/x86\.64/gi, 'x86_64') + .replace(/(Windows Phone)(?! OS)/, '$1 OS') + .split(' on ')[0] + ); + + return os; + } + /** * An iteration utility for arrays and objects. * @@ -116,11 +170,11 @@ } /** - * Gets the internal [[Class]] of a value. + * Gets the internal `[[Class]]` of a value. * * @private * @param {*} value The value. - * @returns {string} The [[Class]]. + * @returns {string} The `[[Class]]`. */ function getClassOf(value) { return value == null @@ -222,7 +276,7 @@ ? !!nav.likeChrome : /\bChrome\b/.test(ua) && !/internal|\n/i.test(toString.toString()); - /** Internal [[Class]] value shortcuts */ + /** Internal `[[Class]]` value shortcuts */ var objectClass = 'Object', airRuntimeClass = isCustomContext ? objectClass : 'ScriptBridgingProxyObject', enviroClass = isCustomContext ? objectClass : 'Environment', @@ -245,13 +299,13 @@ var doc = context.document || {}; /** - * Detect Opera browser + * Detect Opera browser (Presto-based) * http://www.howtocreate.co.uk/operaStuff/operaObject.html * http://dev.opera.com/articles/view/opera-mini-web-content-authoring-guidelines/#operamini */ var opera = context.operamini || context.opera; - /** Opera [[Class]] */ + /** Opera `[[Class]]` */ var operaClass = reOpera.test(operaClass = (isCustomContext && opera) ? opera['[[Class]]'] : getClassOf(opera)) ? operaClass : (opera = null); @@ -276,6 +330,9 @@ /** The browser/environment version */ var version = useFeatures && opera && typeof opera.version == 'function' && opera.version(); + /** A flag to indicate if the OS ends with "/ Version" */ + var isSpecialCasedOS; + /* Detectable layout engines (order is important) */ var layout = getLayout([ { 'label': 'WebKit', 'pattern': 'AppleWebKit' }, @@ -293,6 +350,7 @@ 'Adobe AIR', 'Arora', 'Avant Browser', + 'Breach', 'Camino', 'Epiphany', 'Fennec', @@ -320,6 +378,7 @@ 'Swiftfox', 'WebPositive', 'Opera Mini', + { 'label': 'Opera Mini', 'pattern': 'OPiOS' }, 'Opera', { 'label': 'Opera', 'pattern': 'OPR' }, 'Chrome', @@ -366,12 +425,12 @@ 'BlackBerry': { 'PlayBook': 1 }, 'Google': { 'Google TV': 1 }, 'HP': { 'TouchPad': 1 }, - 'HTC': { }, - 'LG': { }, + 'HTC': {}, + 'LG': {}, 'Microsoft': { 'Xbox': 1, 'Xbox One': 1 }, 'Motorola': { 'Xoom': 1 }, 'Nintendo': { 'Wii U': 1, 'Wii': 1 }, - 'Nokia': { }, + 'Nokia': {}, 'Samsung': { 'Galaxy S': 1, 'Galaxy S2': 1, 'Galaxy S3': 1, 'Galaxy S4': 1 }, 'Sony': { 'PlayStation 4': 1, 'PlayStation 3': 1, 'PlayStation Vita': 1 } }); @@ -426,7 +485,7 @@ * Picks the manufacturer from an array of guesses. * * @private - * @param {Object} guesses An object of guesses. + * @param {Array} guesses An object of guesses. * @returns {null|string} The detected manufacturer. */ function getManufacturer(guesses) { @@ -468,40 +527,7 @@ if (!result && (result = RegExp('\\b' + pattern + '(?:/[\\d.]+|[ \\w.]*)', 'i').exec(ua) )) { - // platform tokens defined at - // http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx - // http://web.archive.org/web/20081122053950/http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx - data = { - '6.3': '8.1', - '6.2': '8', - '6.1': 'Server 2008 R2 / 7', - '6.0': 'Server 2008 / Vista', - '5.2': 'Server 2003 / XP 64-bit', - '5.1': 'XP', - '5.01': '2000 SP1', - '5.0': '2000', - '4.0': 'NT', - '4.90': 'ME' - }; - // detect Windows version from platform tokens - if (/^Win/i.test(result) && - (data = data[0/*Opera 9.25 fix*/, /[\d.]+$/.exec(result)])) { - result = 'Windows ' + data; - } - // correct character case and cleanup - result = format(String(result) - .replace(RegExp(pattern, 'i'), guess.label || guess) - .replace(/ ce$/i, ' CE') - .replace(/hpw/i, 'web') - .replace(/Macintosh/, 'Mac OS') - .replace(/_PowerPC/i, ' OS') - .replace(/(OS X) [^ \d]+/i, '$1') - .replace(/Mac (OS X)/, '$1') - .replace(/\/(\d)/, ' $1') - .replace(/_/g, '.') - .replace(/(?: BePC|[ .]*fc[ \d.]+)$/i, '') - .replace(/x86\.64/gi, 'x86_64') - .split(' on ')[0]); + result = cleanupOS(result, pattern, guess.label || guess); } return result; }); @@ -578,6 +604,10 @@ if (/\bSimulator\b/i.test(ua)) { product = (product ? product + ' ' : '') + 'Simulator'; } + // detect Opera Mini 8+ running in Turbo / Uncompressed mode on iOS + if (name == 'Opera Mini' && /OPiOS/.test(ua)) { + description.push('running in Turbo / Uncompressed mode'); + } // detect iOS if (/^iP/.test(product)) { name || (name = 'Safari'); @@ -618,7 +648,7 @@ // detect non-Opera versions (order is important) if (!version) { version = getVersion([ - '(?:Cloud9|CriOS|CrMo|Iron|Opera ?Mini|OPR|Raven|Silk(?!/[\\d.]+$))', + '(?:Cloud9|CriOS|CrMo|Iron|Opera ?Mini|OPiOS|OPR|Raven|Silk(?!/[\\d.]+$))', 'Version', qualify(name), '(?:Firefox|Minefield|NetFront)' @@ -639,9 +669,12 @@ layout = ['NetFront']; } // detect IE 11 and above - if (!name && layout == 'Trident') { + if (name != 'IE' && layout == 'Trident' && (data = /\brv:([\d.]+)/.exec(ua))) { + if (name) { + description.push('identifying as ' + name + (version ? ' ' + version : '')); + } name = 'IE'; - version = (/\brv:([\d.]+)/.exec(ua) || 0)[1]; + version = data[1]; } // leverage environment features if (useFeatures) { @@ -653,28 +686,23 @@ arch = data.getProperty('os.arch'); os = os || data.getProperty('os.name') + ' ' + data.getProperty('os.version'); } - if (isHostType(context, 'exports')) { - if (isModuleScope && isHostType(context, 'system') && (data = [context.system])[0]) { - os || (os = data[0].os || null); - try { - data[1] = (data[1] = context.require) && data[1]('ringo/engine').version; - version = data[1].join('.'); - name = 'RingoJS'; - } catch(e) { - if (data[0].global.system == context.system) { - name = 'Narwhal'; - } + if (isModuleScope && isHostType(context, 'system') && (data = [context.system])[0]) { + os || (os = data[0].os || null); + try { + data[1] = context.require('ringo/engine').version; + version = data[1].join('.'); + name = 'RingoJS'; + } catch(e) { + if (data[0].global.system == context.system) { + name = 'Narwhal'; } } - else if (typeof context.process == 'object' && (data = context.process)) { - name = 'Node.js'; - arch = data.arch; - os = data.platform; - version = /[\d.]+/.exec(data.version)[0]; - } - else if (rhino) { - name = 'Rhino'; - } + } + else if (typeof context.process == 'object' && (data = context.process)) { + name = 'Node.js'; + arch = data.arch; + os = data.platform; + version = /[\d.]+/.exec(data.version)[0]; } else if (rhino) { name = 'Rhino'; @@ -875,7 +903,7 @@ // add layout engine if (layout && !/Avant|Nook/.test(name) && ( /Browser|Lunascape|Maxthon/.test(name) || - /^(?:Adobe|Arora|Midori|Phantom|Rekonq|Rock|Sleipnir|Web)/.test(name) && layout[1])) { + /^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Sleipnir|Web)/.test(name) && layout[1])) { // don't add layout details to description if they are falsey (data = layout[layout.length - 1]) && description.push(data); } @@ -894,13 +922,14 @@ // parse OS into an object if (os) { data = / ([\d.+]+)$/.exec(os); + isSpecialCasedOS = data && os.charAt(os.length - data[0].length - 1) == '/'; os = { 'architecture': 32, - 'family': data ? os.replace(data[0], '') : os, + 'family': (data && !isSpecialCasedOS) ? os.replace(data[0], '') : os, 'version': data ? data[1] : null, 'toString': function() { var version = this.version; - return this.family + (version ? ' ' + version : '') + (this.architecture == 64 ? ' 64-bit' : ''); + return this.family + ((version && !isSpecialCasedOS) ? ' ' + version : '') + (this.architecture == 64 ? ' 64-bit' : ''); } }; } @@ -911,7 +940,7 @@ os.family = os.family.replace(RegExp(' *' + data), ''); } if (name && (/WOW64/i.test(ua) || - (useFeatures && /\w(?:86|32)$/.test(nav.cpuClass || nav.platform)))) { + (useFeatures && /\w(?:86|32)$/.test(nav.cpuClass || nav.platform) && !/^win32$/i.test(nav.platform)))) { description.unshift('32-bit'); } } @@ -1011,6 +1040,11 @@ /** * The family of the OS. * + * Common values include: + * "Windows", "Windows Server 2008 R2 / 7", "Windows Server 2008 / Vista", + * "Windows XP", "OS X", "Ubuntu", "Debian", "Fedora", "Red Hat", "SuSE", + * "Android", "iOS" and "Windows Phone OS" + * * @memberOf platform.os * @type string|null */ diff --git a/vendor/qunit-extras/qunit-extras.js b/vendor/qunit-extras/qunit-extras.js index 2d6aaeea7..e8ad1062e 100644 --- a/vendor/qunit-extras/qunit-extras.js +++ b/vendor/qunit-extras/qunit-extras.js @@ -186,7 +186,7 @@ var moduleName, modulePrinted; - /** Object shortcuts */ + /** Object references */ var phantom = context.phantom, define = context.define, document = !phantom && context.document, @@ -324,7 +324,7 @@ if (!amd && typeof require == 'function') { try { return require('system').env[name]; - } catch(e) { } + } catch(e) {} } } @@ -557,7 +557,7 @@ } else { process.exit(0); } - } catch(e) { } + } catch(e) {} // exit out of Narwhal, Rhino, or RingoJS try { @@ -566,7 +566,7 @@ } else { quit(); } - } catch(e) { } + } catch(e) {} }; }()); @@ -687,9 +687,9 @@ context.setTimeout = setTimeout; } }()); - } catch(e) { } + } catch(e) {} - // expose shortcuts + // expose QUnit API on `context` // exclude `module` because some environments have it as a built-in object ('asyncTest deepEqual equal equals expect notDeepEqual notEqual notStrictEqual ' + 'ok raises same start stop strictEqual test throws').replace(/\S+/g, function(methodName) {