Update bower dependencies.

This commit is contained in:
Your Name 2014-06-06 14:29:32 +02:00
commit ffc4dc9ec7
715 changed files with 4134 additions and 134336 deletions

View file

@ -1,6 +1,6 @@
{
"name": "es5-shim",
"version": "3.1.1",
"version": "3.4.0",
"main": "es5-shim.js",
"repository": {
"type": "git",
@ -32,13 +32,13 @@
"bower_components",
"tests"
],
"_release": "3.1.1",
"_release": "3.4.0",
"_resolution": {
"type": "version",
"tag": "v3.1.1",
"commit": "f5ca40f6f49b7eb0abef39bb1c3a5b4f7ca176d5"
"tag": "v3.4.0",
"commit": "6751d3f058227ae2450f2f5dd5097d5005c5f93d"
},
"_source": "git://github.com/es-shims/es5-shim.git",
"_target": "~3.1.1",
"_target": "~3.4.0",
"_originalSource": "es5-shim"
}

View file

@ -1,3 +1,25 @@
3.4.0
- Removed nonstandard SpiderMonkey extension to Array#splice - when `deleteCount` is omitted, it's now treated as 0. (#192, #239)
- Fix Object.keys with Arguments objects in Safari 5.0
- Now shimming String#split in Opera 10.6
- Avoid using "toString" as a variable name, since that breaks Opera
- Internal implementation and test cleanups
3.3.2
- Remove an internal "bind" call, which should make the shim a bit faster
- Fix a bug with object boxing in Array#reduceRight that was failing a test in IE 6
3.3.1
- Fixing an Array#splice bug in IE 6/7
- cleaning up Array#splice tests
3.3.0
- Fix Array#reduceRight in node 0.6 and older browsers (#238)
3.2.0
- Fix es5-sham UMD definition to work properly with AMD (#237)
- Ensure that Array methods do not autobox context in strict mode (#233)
3.1.1
- Update minified files (#231)

View file

@ -61,11 +61,6 @@ To run the tests, navigate to <root-folder>/tests/.
prototypically from another, this should work fine across legacy
engines.
:warning: Object.create(null) will work only in browsers that
support prototype assignment. This creates an object that does not
have any properties inherited from Object.prototype. It will
silently fail otherwise.
:warning: The second argument is passed to Object.defineProperties
which will probably fail either silently or with extreme predudice.

View file

@ -1,6 +1,6 @@
{
"name": "es5-shim",
"version": "3.1.1",
"version": "3.4.0",
"main": "es5-shim.js",
"repository": {
"type": "git",

View file

@ -2,7 +2,7 @@
"name": "es5-shim",
"repo": "es-shims/es5-shim",
"description": "ECMAScript 5 compatibility shims for legacy JavaScript engines",
"version": "v3.1.1",
"version": "v3.4.0",
"keywords": [
"shim",
"es5",

View file

@ -8,20 +8,23 @@
//Add semicolon to prevent IIFE from being passed as argument to concated code.
;
// Module systems magic dance
(function (definition) {
// RequireJS
if (typeof define === "function") {
define(definition);
// YUI3
} else if (typeof YUI === "function") {
YUI.add("es5-sham", definition);
// CommonJS and <script>
} else {
definition();
}
})(function () {
// UMD (Universal Module Definition)
// see https://github.com/umdjs/umd/blob/master/returnExports.js
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(factory);
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like enviroments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root.returnExports = factory();
}
}(this, function () {
var call = Function.prototype.call;
var prototypeOfObject = Object.prototype;
@ -32,8 +35,8 @@ var defineGetter;
var defineSetter;
var lookupGetter;
var lookupSetter;
var supportsAccessors;
if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
var supportsAccessors = owns(prototypeOfObject, "__defineGetter__");
if (supportsAccessors) {
defineGetter = call.bind(prototypeOfObject.__defineGetter__);
defineSetter = call.bind(prototypeOfObject.__defineSetter__);
lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
@ -463,4 +466,5 @@ if (!Object.isExtensible) {
};
}
});
}));

File diff suppressed because one or more lines are too long

View file

@ -3,5 +3,5 @@
* @license es5-shim Copyright 2009-2014 by contributors, MIT License
* see https://github.com/es-shims/es5-shim/blob/master/LICENSE
*/
(function(e){if(typeof define==="function"){define(e)}else if(typeof YUI==="function"){YUI.add("es5-sham",e)}else{e()}})(function(){var e=Function.prototype.call;var t=Object.prototype;var r=e.bind(t.hasOwnProperty);var n;var o;var i;var c;var f;if(f=r(t,"__defineGetter__")){n=e.bind(t.__defineGetter__);o=e.bind(t.__defineSetter__);i=e.bind(t.__lookupGetter__);c=e.bind(t.__lookupSetter__)}if(!Object.getPrototypeOf){Object.getPrototypeOf=function g(e){var r=e.__proto__;if(r||r===null){return r}else if(e.constructor){return e.constructor.prototype}else{return t}}}function u(e){try{e.sentinel=0;return Object.getOwnPropertyDescriptor(e,"sentinel").value===0}catch(t){}}if(Object.defineProperty){var p=u({});var a=typeof document==="undefined"||u(document.createElement("div"));if(!a||!p){var l=Object.getOwnPropertyDescriptor}}if(!Object.getOwnPropertyDescriptor||l){var b="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function E(e,n){if(typeof e!=="object"&&typeof e!=="function"||e===null){throw new TypeError(b+e)}if(l){try{return l.call(Object,e,n)}catch(o){}}if(!r(e,n)){return}var u={enumerable:true,configurable:true};if(f){var p=e.__proto__;var a=e!==t;if(a){e.__proto__=t}var _=i(e,n);var s=c(e,n);if(a){e.__proto__=p}if(_||s){if(_){u.get=_}if(s){u.set=s}return u}}u.value=e[n];u.writable=true;return u}}if(!Object.getOwnPropertyNames){Object.getOwnPropertyNames=function z(e){return Object.keys(e)}}if(!Object.create){var _;var s=!({__proto__:null}instanceof Object);if(s||typeof document==="undefined"){_=function(){return{__proto__:null}}}else{_=function(){var e=document.createElement("iframe");var t=document.body||document.documentElement;e.style.display="none";t.appendChild(e);e.src="javascript:";var r=e.contentWindow.Object.prototype;t.removeChild(e);e=null;delete r.constructor;delete r.hasOwnProperty;delete r.propertyIsEnumerable;delete r.isPrototypeOf;delete r.toLocaleString;delete r.toString;delete r.valueOf;r.__proto__=null;function n(){}n.prototype=r;_=function(){return new n};return new n}}Object.create=function S(e,t){var r;function n(){}if(e===null){r=_()}else{if(typeof e!=="object"&&typeof e!=="function"){throw new TypeError("Object prototype may only be an Object or null")}n.prototype=e;r=new n;r.__proto__=e}if(t!==void 0){Object.defineProperties(r,t)}return r}}function d(e){try{Object.defineProperty(e,"sentinel",{});return"sentinel"in e}catch(t){}}if(Object.defineProperty){var y=d({});var O=typeof document==="undefined"||d(document.createElement("div"));if(!y||!O){var j=Object.defineProperty,v=Object.defineProperties}}if(!Object.defineProperty||j){var w="Property description must be an object: ";var P="Object.defineProperty called on non-object: ";var m="getters & setters can not be defined "+"on this javascript engine";Object.defineProperty=function T(e,u,p){if(typeof e!=="object"&&typeof e!=="function"||e===null){throw new TypeError(P+e)}if(typeof p!=="object"&&typeof p!=="function"||p===null){throw new TypeError(w+p)}if(j){try{return j.call(Object,e,u,p)}catch(a){}}if(r(p,"value")){if(f&&(i(e,u)||c(e,u))){var l=e.__proto__;e.__proto__=t;delete e[u];e[u]=p.value;e.__proto__=l}else{e[u]=p.value}}else{if(!f){throw new TypeError(m)}if(r(p,"get")){n(e,u,p.get)}if(r(p,"set")){o(e,u,p.set)}}return e}}if(!Object.defineProperties||v){Object.defineProperties=function D(e,t){if(v){try{return v.call(Object,e,t)}catch(n){}}for(var o in t){if(r(t,o)&&o!=="__proto__"){Object.defineProperty(e,o,t[o])}}return e}}if(!Object.seal){Object.seal=function x(e){return e}}if(!Object.freeze){Object.freeze=function k(e){return e}}try{Object.freeze(function(){})}catch(h){Object.freeze=function F(e){return function t(r){if(typeof r==="function"){return r}else{return e(r)}}}(Object.freeze)}if(!Object.preventExtensions){Object.preventExtensions=function G(e){return e}}if(!Object.isSealed){Object.isSealed=function I(e){return false}}if(!Object.isFrozen){Object.isFrozen=function C(e){return false}}if(!Object.isExtensible){Object.isExtensible=function N(e){if(Object(e)!==e){throw new TypeError}var t="";while(r(e,t)){t+="?"}e[t]=true;var n=r(e,t);delete e[t];return n}}});
(function(e,t){if(typeof define==="function"&&define.amd){define(t)}else if(typeof exports==="object"){module.exports=t()}else{e.returnExports=t()}})(this,function(){var e=Function.prototype.call;var t=Object.prototype;var r=e.bind(t.hasOwnProperty);var n;var o;var i;var c;var f=r(t,"__defineGetter__");if(f){n=e.bind(t.__defineGetter__);o=e.bind(t.__defineSetter__);i=e.bind(t.__lookupGetter__);c=e.bind(t.__lookupSetter__)}if(!Object.getPrototypeOf){Object.getPrototypeOf=function g(e){var r=e.__proto__;if(r||r===null){return r}else if(e.constructor){return e.constructor.prototype}else{return t}}}function u(e){try{e.sentinel=0;return Object.getOwnPropertyDescriptor(e,"sentinel").value===0}catch(t){}}if(Object.defineProperty){var p=u({});var a=typeof document==="undefined"||u(document.createElement("div"));if(!a||!p){var l=Object.getOwnPropertyDescriptor}}if(!Object.getOwnPropertyDescriptor||l){var b="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function E(e,n){if(typeof e!=="object"&&typeof e!=="function"||e===null){throw new TypeError(b+e)}if(l){try{return l.call(Object,e,n)}catch(o){}}if(!r(e,n)){return}var u={enumerable:true,configurable:true};if(f){var p=e.__proto__;var a=e!==t;if(a){e.__proto__=t}var _=i(e,n);var s=c(e,n);if(a){e.__proto__=p}if(_||s){if(_){u.get=_}if(s){u.set=s}return u}}u.value=e[n];u.writable=true;return u}}if(!Object.getOwnPropertyNames){Object.getOwnPropertyNames=function x(e){return Object.keys(e)}}if(!Object.create){var _;var s=!({__proto__:null}instanceof Object);if(s||typeof document==="undefined"){_=function(){return{__proto__:null}}}else{_=function(){var e=document.createElement("iframe");var t=document.body||document.documentElement;e.style.display="none";t.appendChild(e);e.src="javascript:";var r=e.contentWindow.Object.prototype;t.removeChild(e);e=null;delete r.constructor;delete r.hasOwnProperty;delete r.propertyIsEnumerable;delete r.isPrototypeOf;delete r.toLocaleString;delete r.toString;delete r.valueOf;r.__proto__=null;function n(){}n.prototype=r;_=function(){return new n};return new n}}Object.create=function z(e,t){var r;function n(){}if(e===null){r=_()}else{if(typeof e!=="object"&&typeof e!=="function"){throw new TypeError("Object prototype may only be an Object or null")}n.prototype=e;r=new n;r.__proto__=e}if(t!==void 0){Object.defineProperties(r,t)}return r}}function d(e){try{Object.defineProperty(e,"sentinel",{});return"sentinel"in e}catch(t){}}if(Object.defineProperty){var y=d({});var O=typeof document==="undefined"||d(document.createElement("div"));if(!y||!O){var j=Object.defineProperty,v=Object.defineProperties}}if(!Object.defineProperty||j){var w="Property description must be an object: ";var P="Object.defineProperty called on non-object: ";var m="getters & setters can not be defined "+"on this javascript engine";Object.defineProperty=function S(e,u,p){if(typeof e!=="object"&&typeof e!=="function"||e===null){throw new TypeError(P+e)}if(typeof p!=="object"&&typeof p!=="function"||p===null){throw new TypeError(w+p)}if(j){try{return j.call(Object,e,u,p)}catch(a){}}if(r(p,"value")){if(f&&(i(e,u)||c(e,u))){var l=e.__proto__;e.__proto__=t;delete e[u];e[u]=p.value;e.__proto__=l}else{e[u]=p.value}}else{if(!f){throw new TypeError(m)}if(r(p,"get")){n(e,u,p.get)}if(r(p,"set")){o(e,u,p.set)}}return e}}if(!Object.defineProperties||v){Object.defineProperties=function T(e,t){if(v){try{return v.call(Object,e,t)}catch(n){}}for(var o in t){if(r(t,o)&&o!=="__proto__"){Object.defineProperty(e,o,t[o])}}return e}}if(!Object.seal){Object.seal=function D(e){return e}}if(!Object.freeze){Object.freeze=function k(e){return e}}try{Object.freeze(function(){})}catch(h){Object.freeze=function F(e){return function t(r){if(typeof r==="function"){return r}else{return e(r)}}}(Object.freeze)}if(!Object.preventExtensions){Object.preventExtensions=function G(e){return e}}if(!Object.isSealed){Object.isSealed=function C(e){return false}}if(!Object.isFrozen){Object.isFrozen=function N(e){return false}}if(!Object.isExtensible){Object.isExtensible=function I(e){if(Object(e)!==e){throw new TypeError}var t="";while(r(e,t)){t+="?"}e[t]=true;var n=r(e,t);delete e[t];return n}}});
//# sourceMappingURL=es5-sham.map

View file

@ -23,7 +23,7 @@
} else {
// Browser globals (root is window)
root.returnExports = factory();
}
}
}(this, function () {
/**
@ -45,12 +45,31 @@ var array_splice = Array.prototype.splice;
var array_push = Array.prototype.push;
var array_unshift = Array.prototype.unshift;
// Having a toString local variable name breaks in Opera so use _toString.
var _toString = prototypeOfObject.toString;
var isFunction = function (val) {
return prototypeOfObject.toString.call(val) === '[object Function]';
};
var isRegex = function (val) {
return prototypeOfObject.toString.call(val) === '[object RegExp]';
};
var isArray = function isArray(obj) {
return _toString.call(obj) === "[object Array]";
};
var isArguments = function isArguments(value) {
var str = _toString.call(value);
var isArgs = str === '[object Arguments]';
if (!isArgs) {
isArgs = !isArray(str)
&& value !== null
&& typeof value === 'object'
&& typeof value.length === 'number'
&& value.length >= 0
&& isFunction(value.callee);
}
return isArgs;
};
//
// Function
@ -161,7 +180,7 @@ if (!Function.prototype.bind) {
// for ex.) all use of eval or Function costructor throws an exception.
// However in all of these environments Function.prototype.bind exists
// and so this code will never be executed.
var bound = Function("binder", "return function(" + boundArgs.join(",") + "){return binder.apply(this,arguments)}")(binder);
var bound = Function("binder", "return function (" + boundArgs.join(",") + "){return binder.apply(this,arguments)}")(binder);
if (target.prototype) {
Empty.prototype = target.prototype;
@ -198,8 +217,6 @@ if (!Function.prototype.bind) {
// _Please note: Shortcuts are defined after `Function.prototype.bind` as we
// us it in defining shortcuts.
var owns = call.bind(prototypeOfObject.hasOwnProperty);
// Having a toString local variable name breaks in Opera so use _toString.
var _toString = call.bind(prototypeOfObject.toString);
// If JS engine supports accessors creating shortcuts.
var defineGetter;
@ -221,92 +238,36 @@ if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
// ES5 15.4.4.12
// http://es5.github.com/#x15.4.4.12
// Default value for second param
// [bugfix, ielt9, old browsers]
// IE < 9 bug: [1,2].splice(0).join("") === "" but should be "12"
if ([1, 2].splice(0).length !== 2) {
if (function () { // test IE < 9 to splice bug - see issue #138
function makeArray(l) {
var a = [];
while (l--) {
a.unshift(l);
}
return a;
var spliceWorksWithEmptyObject = (function () {
var obj = {};
Array.prototype.splice.call(obj, 0, 0, 1);
return obj.length === 1;
}());
var omittingSecondSpliceArgIsNoop = [1].splice(0).length === 0;
var spliceNoopReturnsEmptyArray = (function () {
var a = [1, 2];
var result = a.splice();
return a.length === 2 && isArray(result) && result.length === 0;
}());
if (spliceNoopReturnsEmptyArray) {
// Safari 5.0 bug where .split() returns undefined
Array.prototype.splice = function splice(start, deleteCount) {
if (arguments.length === 0) { return []; }
else { return array_splice.apply(this, arguments); }
};
}
if (!omittingSecondSpliceArgIsNoop || !spliceWorksWithEmptyObject) {
Array.prototype.splice = function splice(start, deleteCount) {
if (arguments.length === 0) { return []; }
var args = arguments;
this.length = Math.max(toInteger(this.length), 0);
if (arguments.length > 0 && typeof deleteCount !== 'number') {
args = _Array_slice_.call(arguments);
if (args.length < 2) { args.push(toInteger(deleteCount)); }
else { args[1] = toInteger(deleteCount); }
}
var array = [];
var lengthBefore;
array.splice.bind(array, 0, 0).apply(null, makeArray(20));
array.splice.bind(array, 0, 0).apply(null, makeArray(26));
lengthBefore = array.length; //20
array.splice(5, 0, "XXX"); // add one element
if (lengthBefore + 1 === array.length) {
return true;// has right splice implementation without bugs
}
// else {
// IE8 bug
// }
}()) { // IE 6/7
Array.prototype.splice = function(start, deleteCount) {
if (!arguments.length) {
return [];
} else {
return array_splice.apply(this, [
start === void 0 ? 0 : start,
deleteCount === void 0 ? (this.length - start) : deleteCount
].concat(_Array_slice_.call(arguments, 2)));
}
};
} else { // IE8
Array.prototype.splice = function(start, deleteCount) {
var result;
var args = _Array_slice_.call(arguments, 2);
var addElementsCount = args.length;
if (!arguments.length) {
return [];
}
if (start === void 0) { // default
start = 0;
}
if (deleteCount === void 0) { // default
deleteCount = this.length - start;
}
if (addElementsCount > 0) {
if (deleteCount <= 0) {
if (start === this.length) { // tiny optimisation #1
array_push.apply(this, args);
return [];
}
if (start === 0) { // tiny optimisation #2
array_unshift.apply(this, args);
return [];
}
}
// Array.prototype.splice implementation
result = _Array_slice_.call(this, start, start + deleteCount);// delete part
args.push.apply(args, _Array_slice_.call(this, start + deleteCount, this.length));// right part
args.unshift.apply(args, _Array_slice_.call(this, 0, start));// left part
// delete all items from this array and replace it to 'left part' + _Array_slice_.call(arguments, 2) + 'right part'
args.unshift(0, this.length);
array_splice.apply(this, args);
return result;
}
return array_splice.call(this, start, deleteCount);
};
}
return array_splice.apply(this, args);
};
}
// ES5 15.4.4.12
@ -315,7 +276,7 @@ if ([1, 2].splice(0).length !== 2) {
// [bugfix, ielt8]
// IE < 8 bug: [].unshift(0) === undefined but should be "1"
if ([].unshift(0) !== 1) {
Array.prototype.unshift = function() {
Array.prototype.unshift = function () {
array_unshift.apply(this, arguments);
return this.length;
};
@ -325,9 +286,7 @@ if ([].unshift(0) !== 1) {
// http://es5.github.com/#x15.4.3.2
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray
if (!Array.isArray) {
Array.isArray = function isArray(obj) {
return _toString(obj) === "[object Array]";
};
Array.isArray = isArray;
}
// The IsCallable() check in the Array functions
@ -346,7 +305,6 @@ if (!Array.isArray) {
// http://es5.github.com/#x15.4.4.18
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/forEach
// Check failure of by-index access of string characters (IE < 9)
// and failure of `0 in boxedString` (Rhino)
var boxedString = Object("a");
@ -354,19 +312,25 @@ var splitString = boxedString[0] !== "a" || !(0 in boxedString);
var properlyBoxesContext = function properlyBoxed(method) {
// Check node 0.6.21 bug where third parameter is not boxed
var properlyBoxes = true;
var properlyBoxesNonStrict = true;
var properlyBoxesStrict = true;
if (method) {
method.call('foo', function (_, __, context) {
if (typeof context !== 'object') { properlyBoxes = false; }
if (typeof context !== 'object') { properlyBoxesNonStrict = false; }
});
method.call([1], function () {
'use strict';
properlyBoxesStrict = typeof this === 'string';
}, 'x');
}
return !!method && properlyBoxes;
return !!method && properlyBoxesNonStrict && properlyBoxesStrict;
};
if (!Array.prototype.forEach || !properlyBoxesContext(Array.prototype.forEach)) {
Array.prototype.forEach = function forEach(fun /*, thisp*/) {
var object = toObject(this),
self = splitString && _toString(this) === "[object String]" ?
self = splitString && _toString.call(this) === "[object String]" ?
this.split("") :
object,
thisp = arguments[1],
@ -395,7 +359,7 @@ if (!Array.prototype.forEach || !properlyBoxesContext(Array.prototype.forEach))
if (!Array.prototype.map || !properlyBoxesContext(Array.prototype.map)) {
Array.prototype.map = function map(fun /*, thisp*/) {
var object = toObject(this),
self = splitString && _toString(this) === "[object String]" ?
self = splitString && _toString.call(this) === "[object String]" ?
this.split("") :
object,
length = self.length >>> 0,
@ -408,8 +372,9 @@ if (!Array.prototype.map || !properlyBoxesContext(Array.prototype.map)) {
}
for (var i = 0; i < length; i++) {
if (i in self)
if (i in self) {
result[i] = fun.call(thisp, self[i], i, object);
}
}
return result;
};
@ -421,7 +386,7 @@ if (!Array.prototype.map || !properlyBoxesContext(Array.prototype.map)) {
if (!Array.prototype.filter || !properlyBoxesContext(Array.prototype.filter)) {
Array.prototype.filter = function filter(fun /*, thisp */) {
var object = toObject(this),
self = splitString && _toString(this) === "[object String]" ?
self = splitString && _toString.call(this) === "[object String]" ?
this.split("") :
object,
length = self.length >>> 0,
@ -452,7 +417,7 @@ if (!Array.prototype.filter || !properlyBoxesContext(Array.prototype.filter)) {
if (!Array.prototype.every || !properlyBoxesContext(Array.prototype.every)) {
Array.prototype.every = function every(fun /*, thisp */) {
var object = toObject(this),
self = splitString && _toString(this) === "[object String]" ?
self = splitString && _toString.call(this) === "[object String]" ?
this.split("") :
object,
length = self.length >>> 0,
@ -478,7 +443,7 @@ if (!Array.prototype.every || !properlyBoxesContext(Array.prototype.every)) {
if (!Array.prototype.some || !properlyBoxesContext(Array.prototype.some)) {
Array.prototype.some = function some(fun /*, thisp */) {
var object = toObject(this),
self = splitString && _toString(this) === "[object String]" ?
self = splitString && _toString.call(this) === "[object String]" ?
this.split("") :
object,
length = self.length >>> 0,
@ -503,12 +468,12 @@ if (!Array.prototype.some || !properlyBoxesContext(Array.prototype.some)) {
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce
var reduceCoercesToObject = false;
if (Array.prototype.reduce) {
reduceCoercesToObject = typeof Array.prototype.reduce.call('a', function (_, __, ___, list) { return list; }) === 'object';
reduceCoercesToObject = typeof Array.prototype.reduce.call('es5', function (_, __, ___, list) { return list; }) === 'object';
}
if (!Array.prototype.reduce || !reduceCoercesToObject) {
Array.prototype.reduce = function reduce(fun /*, initial*/) {
var object = toObject(this),
self = splitString && _toString(this) === "[object String]" ?
self = splitString && _toString.call(this) === "[object String]" ?
this.split("") :
object,
length = self.length >>> 0;
@ -554,10 +519,14 @@ if (!Array.prototype.reduce || !reduceCoercesToObject) {
// ES5 15.4.4.22
// http://es5.github.com/#x15.4.4.22
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight
if (!Array.prototype.reduceRight) {
var reduceRightCoercesToObject = false;
if (Array.prototype.reduceRight) {
reduceRightCoercesToObject = typeof Array.prototype.reduceRight.call('es5', function (_, __, ___, list) { return list; }) === 'object';
}
if (!Array.prototype.reduceRight || !reduceRightCoercesToObject) {
Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
var object = toObject(this),
self = splitString && _toString(this) === "[object String]" ?
self = splitString && _toString.call(this) === "[object String]" ?
this.split("") :
object,
length = self.length >>> 0;
@ -594,7 +563,7 @@ if (!Array.prototype.reduceRight) {
}
do {
if (i in this) {
if (i in self) {
result = fun.call(void 0, result, self[i], i, object);
}
} while (i--);
@ -608,7 +577,7 @@ if (!Array.prototype.reduceRight) {
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf
if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) !== -1)) {
Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
var self = splitString && _toString(this) === "[object String]" ?
var self = splitString && _toString.call(this) === "[object String]" ?
this.split("") :
toObject(this),
length = self.length >>> 0;
@ -638,7 +607,7 @@ if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) !== -1)) {
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf
if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) !== -1)) {
Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
var self = splitString && _toString(this) === "[object String]" ?
var self = splitString && _toString.call(this) === "[object String]" ?
this.split("") :
toObject(this),
length = self.length >>> 0;
@ -668,6 +637,9 @@ if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) !== -1)) {
// ES5 15.2.3.14
// http://es5.github.com/#x15.2.3.14
var keysWorksWithArguments = Object.keys && (function () {
return Object.keys(arguments).length === 2;
}(1, 2));
if (!Object.keys) {
// http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
var hasDontEnumBug = !({'toString': null}).propertyIsEnumerable('toString'),
@ -681,26 +653,13 @@ if (!Object.keys) {
"propertyIsEnumerable",
"constructor"
],
dontEnumsLength = dontEnums.length,
isArguments = function isArguments(value) {
var str = _toString(value);
var isArgs = str === '[object Arguments]';
if (!isArgs) {
isArgs = !Array.isArray(str)
&& value !== null
&& typeof value === 'object'
&& typeof value.length === 'number'
&& value.length >= 0
&& isFunction(value.callee);
}
return isArgs;
};
dontEnumsLength = dontEnums.length;
Object.keys = function keys(object) {
var isFn = isFunction(object),
isArgs = isArguments(object),
isObject = object !== null && typeof object === 'object',
isString = isObject && _toString(object) === '[object String]';
isString = isObject && _toString.call(object) === '[object String]';
if (!isObject && !isFn && !isArgs) {
throw new TypeError("Object.keys called on a non-object");
@ -732,7 +691,16 @@ if (!Object.keys) {
}
return theKeys;
};
} else if (!keysWorksWithArguments) {
// Safari 5.0 bug
var originalKeys = Object.keys;
Object.keys = function keys(object) {
if (isArguments(object)) {
return originalKeys(Array.prototype.slice.call(object));
} else {
return originalKeys(object);
}
};
}
//
@ -767,12 +735,10 @@ if (
month = (month % 12 + 12) % 12;
// the date time string format is specified in 15.9.1.15.
result = [month + 1, this.getUTCDate(),
this.getUTCHours(), this.getUTCMinutes(), this.getUTCSeconds()];
result = [month + 1, this.getUTCDate(), this.getUTCHours(), this.getUTCMinutes(), this.getUTCSeconds()];
year = (
(year < 0 ? "-" : (year > 9999 ? "+" : "")) +
("00000" + Math.abs(year))
.slice(0 <= year && year <= 9999 ? -4 : -6)
("00000" + Math.abs(year)).slice(0 <= year && year <= 9999 ? -4 : -6)
);
length = result.length;
@ -859,7 +825,7 @@ var doesNotParseY2KNewYear = isNaN(Date.parse("2000-01-01T00:00:00.000Z"));
if (!Date.parse || doesNotParseY2KNewYear || acceptsInvalidDates || !supportsExtendedYears) {
// XXX global assignment won't work in embeddings that use
// an alternate object for the context.
Date = (function(NativeDate) {
Date = (function (NativeDate) {
// Date.length === 7
function Date(Y, M, D, h, m, s, ms) {
@ -1042,7 +1008,7 @@ if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' || (0.9).toFix
}
}
function toString() {
function numToString() {
var i = size;
var s = '';
while (--i >= 0) {
@ -1137,11 +1103,11 @@ if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' || (0.9).toFix
divide(1 << j);
multiply(1, 1);
divide(2);
m = toString();
m = numToString();
} else {
multiply(0, z);
multiply(1 << (-e), 0);
m = toString() + '0.00000000000000000000'.slice(2, 2 + f);
m = numToString() + '0.00000000000000000000'.slice(2, 2 + f);
}
}
@ -1168,7 +1134,6 @@ if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' || (0.9).toFix
// ======
//
// ES5 15.5.4.14
// http://es5.github.com/#x15.5.4.14
@ -1189,6 +1154,7 @@ if (
'ab'.split(/(?:ab)*/).length !== 2 ||
'.'.split(/(.?)(.?)/).length !== 4 ||
'tesst'.split(/(s)*/)[1] === "t" ||
'test'.split(/(?:)/, -1).length !== 4 ||
''.split(/.?/).length ||
'.'.split(/()()/).length > 1
) {
@ -1197,12 +1163,13 @@ if (
String.prototype.split = function (separator, limit) {
var string = this;
if (separator === void 0 && limit === 0)
if (separator === void 0 && limit === 0) {
return [];
}
// If `separator` is not a regex, use native split
if (Object.prototype.toString.call(separator) !== "[object RegExp]") {
return string_split.apply(this, arguments);
if (_toString.call(separator) !== "[object RegExp]") {
return string_split.call(this, separator, limit);
}
var output = [],
@ -1228,7 +1195,7 @@ if (
*/
limit = limit === void 0 ?
-1 >>> 0 : // Math.pow(2, 32) - 1
limit >>> 0; // ToUint32(limit)
ToUint32(limit);
while (match = separator.exec(string)) {
// `separator.lastIndex` is not reliable cross-browser
lastIndex = match.index + match[0].length;
@ -1277,8 +1244,8 @@ if (
// "0".split(undefined, 0) -> []
} else if ("0".split(void 0, 0).length) {
String.prototype.split = function split(separator, limit) {
if (separator === void 0 && limit === 0) return [];
return string_split.apply(this, arguments);
if (separator === void 0 && limit === 0) { return []; }
return string_split.call(this, separator, limit);
};
}
@ -1296,7 +1263,7 @@ if (!replaceReportsGroupsCorrectly) {
var isFn = isFunction(replaceValue);
var hasCapturingGroups = isRegex(searchValue) && (/\)[*?]/).test(searchValue.source);
if (!isFn || !hasCapturingGroups) {
return str_replace.apply(this, arguments);
return str_replace.call(this, searchValue, replaceValue);
} else {
var wrappedReplaceValue = function (match) {
var length = arguments.length;
@ -1313,7 +1280,7 @@ if (!replaceReportsGroupsCorrectly) {
}
// ECMA-262, 3rd B.2.3
// Note an ECMAScript standart, although ECMAScript 3rd Edition has a
// Not an ECMAScript standard, although ECMAScript 3rd Edition has a
// non-normative section suggesting uniform semantics and it should be
// normalized across all browsers
// [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IE
@ -1348,7 +1315,7 @@ if (!String.prototype.trim || ws.trim() || !zeroWidth.trim()) {
trimEndRegexp = new RegExp(ws + ws + "*$");
String.prototype.trim = function trim() {
if (this === void 0 || this === null) {
throw new TypeError("can't convert "+this+" to object");
throw new TypeError("can't convert " + this + " to object");
}
return String(this)
.replace(trimBeginRegexp, "")
@ -1383,7 +1350,7 @@ function toInteger(n) {
n = +n;
if (n !== n) { // isNaN
n = 0;
} else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
} else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) {
n = (n > 0 || -1) * Math.floor(Math.abs(n));
}
return n;
@ -1426,9 +1393,13 @@ function toPrimitive(input) {
// http://es5.github.com/#x9.9
var toObject = function (o) {
if (o == null) { // this matches both null and undefined
throw new TypeError("can't convert "+o+" to object");
throw new TypeError("can't convert " + o + " to object");
}
return Object(o);
};
var ToUint32 = function ToUint32(x) {
return x >>> 0;
};
}));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{
"name": "es5-shim",
"version": "3.1.1",
"version": "3.4.0",
"description": "ECMAScript 5 compatibility shims for legacy JavaScript engines",
"homepage": "http://github.com/es-shims/es5-shim/",
"contributors": [
@ -30,10 +30,12 @@
"minify": "npm run minify-shim && npm run minify-sham",
"minify-shim": "uglifyjs es5-shim.js --comments --source-map=es5-shim.map -m -b ascii_only=true,beautify=false > es5-shim.min.js",
"minify-sham": "uglifyjs es5-sham.js --comments --source-map=es5-sham.map -m -b ascii_only=true,beautify=false > es5-sham.min.js",
"test": "jasmine-node --matchall tests/spec/"
"test": "jasmine-node --matchall tests/spec/",
"lint": "jscs tests/helpers/*.js tests/spec/*.js es5-shim.js es5-sham.js"
},
"devDependencies": {
"jasmine-node": "~1.14.2",
"jscs": "~1.4.5",
"uglify-js": "~2.4.12"
},
"engines": {