webshims-rails 1.14.1 → 1.14.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/webshims-rails/version.rb +2 -2
- data/vendor/assets/javascripts/webshims/extras/modernizr-custom.js +0 -0
- data/vendor/assets/javascripts/webshims/polyfiller.js +3 -8
- data/vendor/assets/javascripts/webshims/shims/FlashCanvas/canvas2png.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/FlashCanvas/flashcanvas.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/FlashCanvas/flashcanvas.swf +0 -0
- data/vendor/assets/javascripts/webshims/shims/FlashCanvas/proxy.php +0 -0
- data/vendor/assets/javascripts/webshims/shims/FlashCanvas/save.php +0 -0
- data/vendor/assets/javascripts/webshims/shims/FlashCanvasPro/canvas2png.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/FlashCanvasPro/flash10canvas.swf +0 -0
- data/vendor/assets/javascripts/webshims/shims/FlashCanvasPro/flash9canvas.swf +0 -0
- data/vendor/assets/javascripts/webshims/shims/FlashCanvasPro/flashcanvas.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/FlashCanvasPro/proxy.php +0 -0
- data/vendor/assets/javascripts/webshims/shims/FlashCanvasPro/save.php +0 -0
- data/vendor/assets/javascripts/webshims/shims/color-picker.js +2 -2
- data/vendor/assets/javascripts/webshims/shims/combos/1.js +66 -43
- data/vendor/assets/javascripts/webshims/shims/combos/10.js +66 -31
- data/vendor/assets/javascripts/webshims/shims/combos/11.js +66 -31
- data/vendor/assets/javascripts/webshims/shims/combos/12.js +96 -59
- data/vendor/assets/javascripts/webshims/shims/combos/13.js +96 -59
- data/vendor/assets/javascripts/webshims/shims/combos/14.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/combos/15.js +4 -1
- data/vendor/assets/javascripts/webshims/shims/combos/16.js +70 -44
- data/vendor/assets/javascripts/webshims/shims/combos/17.js +66 -31
- data/vendor/assets/javascripts/webshims/shims/combos/18.js +1241 -1126
- data/vendor/assets/javascripts/webshims/shims/combos/19.js +1272 -1214
- data/vendor/assets/javascripts/webshims/shims/combos/2.js +66 -43
- data/vendor/assets/javascripts/webshims/shims/combos/20.js +1272 -1214
- data/vendor/assets/javascripts/webshims/shims/combos/21.js +61 -92
- data/vendor/assets/javascripts/webshims/shims/combos/22.js +30 -16
- data/vendor/assets/javascripts/webshims/shims/combos/23.js +66 -43
- data/vendor/assets/javascripts/webshims/shims/combos/25.js +41 -85
- data/vendor/assets/javascripts/webshims/shims/combos/26.js +1556 -2316
- data/vendor/assets/javascripts/webshims/shims/combos/27.js +12 -10
- data/vendor/assets/javascripts/webshims/shims/combos/28.js +4 -1
- data/vendor/assets/javascripts/webshims/shims/combos/29.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/combos/3.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/combos/30.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/combos/31.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/combos/32.js +1175 -1095
- data/vendor/assets/javascripts/webshims/shims/combos/33.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/combos/34.js +30 -16
- data/vendor/assets/javascripts/webshims/shims/combos/4.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/combos/5.js +66 -31
- data/vendor/assets/javascripts/webshims/shims/combos/6.js +66 -31
- data/vendor/assets/javascripts/webshims/shims/combos/7.js +66 -43
- data/vendor/assets/javascripts/webshims/shims/combos/8.js +66 -43
- data/vendor/assets/javascripts/webshims/shims/combos/9.js +66 -31
- data/vendor/assets/javascripts/webshims/shims/combos/97.js +63 -28
- data/vendor/assets/javascripts/webshims/shims/combos/98.js +149 -74
- data/vendor/assets/javascripts/webshims/shims/combos/99.js +149 -74
- data/vendor/assets/javascripts/webshims/shims/combos/comboinfo.json +1 -1
- data/vendor/assets/javascripts/webshims/shims/details.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/dom-extend.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/es5.js +1175 -1095
- data/vendor/assets/javascripts/webshims/shims/excanvas.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/filereader.js +10 -9
- data/vendor/assets/javascripts/webshims/shims/form-combat.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/form-core.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/form-datalist-lazy.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/form-datalist.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/form-fixrangechange.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/form-message.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/form-native-extend.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/form-number-date-api.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/form-number-date-ui.js +40 -11
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend.js +4 -1
- data/vendor/assets/javascripts/webshims/shims/form-shim-extend2.js +2 -1
- data/vendor/assets/javascripts/webshims/shims/form-validation.js +80 -47
- data/vendor/assets/javascripts/webshims/shims/form-validators.js +19 -8
- data/vendor/assets/javascripts/webshims/shims/forms-picker.js +21 -1
- data/vendor/assets/javascripts/webshims/shims/geolocation.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ar.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ch-CN.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-cs.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-de.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-el.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-en.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-es.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-fa.js +130 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-fr.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-he.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-hi.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-hu.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-it.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ja.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-lt.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-nl.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-pl.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-pt-BR.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-pt-PT.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-pt.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-ru.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-sv.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-zh-CN.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/i18n/formcfg-zh-TW.js +130 -0
- data/vendor/assets/javascripts/webshims/shims/jajax.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/jme/_icons.scss +186 -0
- data/vendor/assets/javascripts/webshims/shims/jme/b.js +63 -28
- data/vendor/assets/javascripts/webshims/shims/jme/c.js +86 -46
- data/vendor/assets/javascripts/webshims/shims/jme/controls.css +317 -211
- data/vendor/assets/javascripts/webshims/shims/jme/controls.scss +59 -223
- data/vendor/assets/javascripts/webshims/shims/jme/jme.eot +0 -0
- data/vendor/assets/javascripts/webshims/shims/jme/jme.svg +0 -0
- data/vendor/assets/javascripts/webshims/shims/jme/jme.ttf +0 -0
- data/vendor/assets/javascripts/webshims/shims/jme/jme.woff +0 -0
- data/vendor/assets/javascripts/webshims/shims/jme/mediacontrols-lazy.js +66 -14
- data/vendor/assets/javascripts/webshims/shims/jme/p.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/ChangeLog.txt +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/ReadMe.txt +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/images/AlphaBar.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/images/Bars.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/images/Maps.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/images/NoColor.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/images/bar-opacity.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/images/map-opacity.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/images/mappoint.gif +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/images/picker.gif +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/images/preview-opacity.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/images/rangearrows.gif +0 -0
- data/vendor/assets/javascripts/webshims/shims/jpicker/jpicker.css +55 -48
- data/vendor/assets/javascripts/webshims/shims/mediaelement-core.js +66 -43
- data/vendor/assets/javascripts/webshims/shims/mediaelement-debug.js +833 -0
- data/vendor/assets/javascripts/webshims/shims/mediaelement-jaris.js +31 -76
- data/vendor/assets/javascripts/webshims/shims/mediaelement-native-fix.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/mediaelement-yt.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/moxie/flash/Moxie.cdn.swf +0 -0
- data/vendor/assets/javascripts/webshims/shims/moxie/flash/Moxie.min.swf +0 -0
- data/vendor/assets/javascripts/webshims/shims/moxie/js/moxie.js +1542 -2303
- data/vendor/assets/javascripts/webshims/shims/moxie/silverlight/Moxie.cdn.xap +0 -0
- data/vendor/assets/javascripts/webshims/shims/moxie/silverlight/Moxie.min.xap +0 -0
- data/vendor/assets/javascripts/webshims/shims/picture.js +160 -79
- data/vendor/assets/javascripts/webshims/shims/plugins/jquery.ui.position.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/promise.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/range-ui.js +26 -20
- data/vendor/assets/javascripts/webshims/shims/sizzle.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/styles/color-picker.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/styles/forms-ext.css +444 -326
- data/vendor/assets/javascripts/webshims/shims/styles/forms-picker.css +379 -300
- data/vendor/assets/javascripts/webshims/shims/styles/progress.gif +0 -0
- data/vendor/assets/javascripts/webshims/shims/styles/progress.png +0 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/_api-forms-ext.scss +8 -8
- data/vendor/assets/javascripts/webshims/shims/styles/scss/_api-shim.scss +0 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/_extends.scss +0 -14
- data/vendor/assets/javascripts/webshims/shims/styles/scss/forms-ext.scss +104 -85
- data/vendor/assets/javascripts/webshims/shims/styles/scss/forms-picker.scss +20 -32
- data/vendor/assets/javascripts/webshims/shims/styles/scss/shim-ext.scss +0 -0
- data/vendor/assets/javascripts/webshims/shims/styles/scss/shim.scss +14 -34
- data/vendor/assets/javascripts/webshims/shims/styles/shim-ext.css +920 -728
- data/vendor/assets/javascripts/webshims/shims/styles/shim.css +471 -391
- data/vendor/assets/javascripts/webshims/shims/styles/widget.eot +0 -0
- data/vendor/assets/javascripts/webshims/shims/styles/widget.svg +0 -0
- data/vendor/assets/javascripts/webshims/shims/styles/widget.ttf +0 -0
- data/vendor/assets/javascripts/webshims/shims/styles/widget.woff +0 -0
- data/vendor/assets/javascripts/webshims/shims/swf/JarisFLVPlayer.swf +0 -0
- data/vendor/assets/javascripts/webshims/shims/swfmini-embed.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/swfmini.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/track-ui.js +0 -0
- data/vendor/assets/javascripts/webshims/shims/track.js +30 -16
- metadata +8 -4
- data/vendor/assets/javascripts/webshims/shims/styles/config.rb +0 -12
- data/vendor/assets/javascripts/webshims/shims/swf/filereader.swf +0 -0
File without changes
|
File without changes
|
@@ -5,14 +5,50 @@
|
|
5
5
|
setTimeout(function(){
|
6
6
|
webshims.isReady('es5', true);
|
7
7
|
});
|
8
|
-
/**
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
8
|
+
/**
|
9
|
+
* Brings an environment as close to ECMAScript 5 compliance
|
10
|
+
* as is possible with the facilities of erstwhile engines.
|
11
|
+
*
|
12
|
+
* Annotated ES5: http://es5.github.com/ (specific links below)
|
13
|
+
* ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
|
14
|
+
* Required reading: http://javascriptweblog.wordpress.com/2011/12/05/extending-javascript-natives/
|
15
|
+
*/
|
16
|
+
|
17
|
+
// Shortcut to an often accessed properties, in order to avoid multiple
|
18
|
+
// dereference that costs universally.
|
19
|
+
var call = Function.prototype.call;
|
20
|
+
var prototypeOfArray = Array.prototype;
|
21
|
+
var prototypeOfObject = Object.prototype;
|
22
|
+
var _Array_slice_ = prototypeOfArray.slice;
|
23
|
+
var array_splice = Array.prototype.splice;
|
24
|
+
var array_push = Array.prototype.push;
|
25
|
+
var array_unshift = Array.prototype.unshift;
|
26
|
+
|
27
|
+
// Having a toString local variable name breaks in Opera so use _toString.
|
28
|
+
var _toString = prototypeOfObject.toString;
|
29
|
+
|
30
|
+
var isFunction = function (val) {
|
31
|
+
return prototypeOfObject.toString.call(val) === '[object Function]';
|
32
|
+
};
|
33
|
+
var isRegex = function (val) {
|
34
|
+
return prototypeOfObject.toString.call(val) === '[object RegExp]';
|
35
|
+
};
|
36
|
+
var isArray = function isArray(obj) {
|
37
|
+
return _toString.call(obj) === "[object Array]";
|
38
|
+
};
|
39
|
+
var isArguments = function isArguments(value) {
|
40
|
+
var str = _toString.call(value);
|
41
|
+
var isArgs = str === '[object Arguments]';
|
42
|
+
if (!isArgs) {
|
43
|
+
isArgs = !isArray(str)
|
44
|
+
&& value !== null
|
45
|
+
&& typeof value === 'object'
|
46
|
+
&& typeof value.length === 'number'
|
47
|
+
&& value.length >= 0
|
48
|
+
&& isFunction(value.callee);
|
49
|
+
}
|
50
|
+
return isArgs;
|
51
|
+
};
|
16
52
|
|
17
53
|
//
|
18
54
|
// Function
|
@@ -22,150 +58,157 @@ setTimeout(function(){
|
|
22
58
|
// ES-5 15.3.4.5
|
23
59
|
// http://es5.github.com/#x15.3.4.5
|
24
60
|
|
25
|
-
function Empty() {}
|
61
|
+
function Empty() {}
|
26
62
|
|
27
|
-
if (!Function.prototype.bind) {
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
63
|
+
if (!Function.prototype.bind) {
|
64
|
+
Function.prototype.bind = function bind(that) { // .length is 1
|
65
|
+
// 1. Let Target be the this value.
|
66
|
+
var target = this;
|
67
|
+
// 2. If IsCallable(Target) is false, throw a TypeError exception.
|
68
|
+
if (!isFunction(target)) {
|
69
|
+
throw new TypeError("Function.prototype.bind called on incompatible " + target);
|
70
|
+
}
|
71
|
+
// 3. Let A be a new (possibly empty) internal list of all of the
|
72
|
+
// argument values provided after thisArg (arg1, arg2 etc), in order.
|
73
|
+
// XXX slicedArgs will stand in for "A" if used
|
74
|
+
var args = _Array_slice_.call(arguments, 1); // for normal call
|
75
|
+
// 4. Let F be a new native ECMAScript object.
|
76
|
+
// 11. Set the [[Prototype]] internal property of F to the standard
|
77
|
+
// built-in Function prototype object as specified in 15.3.3.1.
|
78
|
+
// 12. Set the [[Call]] internal property of F as described in
|
79
|
+
// 15.3.4.5.1.
|
80
|
+
// 13. Set the [[Construct]] internal property of F as described in
|
81
|
+
// 15.3.4.5.2.
|
82
|
+
// 14. Set the [[HasInstance]] internal property of F as described in
|
83
|
+
// 15.3.4.5.3.
|
84
|
+
var binder = function () {
|
85
|
+
|
86
|
+
if (this instanceof bound) {
|
87
|
+
// 15.3.4.5.2 [[Construct]]
|
88
|
+
// When the [[Construct]] internal method of a function object,
|
89
|
+
// F that was created using the bind function is called with a
|
90
|
+
// list of arguments ExtraArgs, the following steps are taken:
|
91
|
+
// 1. Let target be the value of F's [[TargetFunction]]
|
92
|
+
// internal property.
|
93
|
+
// 2. If target has no [[Construct]] internal method, a
|
94
|
+
// TypeError exception is thrown.
|
95
|
+
// 3. Let boundArgs be the value of F's [[BoundArgs]] internal
|
96
|
+
// property.
|
97
|
+
// 4. Let args be a new list containing the same values as the
|
98
|
+
// list boundArgs in the same order followed by the same
|
99
|
+
// values as the list ExtraArgs in the same order.
|
100
|
+
// 5. Return the result of calling the [[Construct]] internal
|
101
|
+
// method of target providing args as the arguments.
|
102
|
+
|
103
|
+
var result = target.apply(
|
104
|
+
this,
|
105
|
+
args.concat(_Array_slice_.call(arguments))
|
106
|
+
);
|
107
|
+
if (Object(result) === result) {
|
108
|
+
return result;
|
109
|
+
}
|
110
|
+
return this;
|
111
|
+
|
112
|
+
} else {
|
113
|
+
// 15.3.4.5.1 [[Call]]
|
114
|
+
// When the [[Call]] internal method of a function object, F,
|
115
|
+
// which was created using the bind function is called with a
|
116
|
+
// this value and a list of arguments ExtraArgs, the following
|
117
|
+
// steps are taken:
|
118
|
+
// 1. Let boundArgs be the value of F's [[BoundArgs]] internal
|
119
|
+
// property.
|
120
|
+
// 2. Let boundThis be the value of F's [[BoundThis]] internal
|
121
|
+
// property.
|
122
|
+
// 3. Let target be the value of F's [[TargetFunction]] internal
|
123
|
+
// property.
|
124
|
+
// 4. Let args be a new list containing the same values as the
|
125
|
+
// list boundArgs in the same order followed by the same
|
126
|
+
// values as the list ExtraArgs in the same order.
|
127
|
+
// 5. Return the result of calling the [[Call]] internal method
|
128
|
+
// of target providing boundThis as the this value and
|
129
|
+
// providing args as the arguments.
|
130
|
+
|
131
|
+
// equiv: target.call(this, ...boundArgs, ...args)
|
132
|
+
return target.apply(
|
133
|
+
that,
|
134
|
+
args.concat(_Array_slice_.call(arguments))
|
135
|
+
);
|
136
|
+
|
137
|
+
}
|
138
|
+
|
139
|
+
};
|
140
|
+
|
141
|
+
// 15. If the [[Class]] internal property of Target is "Function", then
|
142
|
+
// a. Let L be the length property of Target minus the length of A.
|
143
|
+
// b. Set the length own property of F to either 0 or L, whichever is
|
144
|
+
// larger.
|
145
|
+
// 16. Else set the length own property of F to 0.
|
146
|
+
|
147
|
+
var boundLength = Math.max(0, target.length - args.length);
|
148
|
+
|
149
|
+
// 17. Set the attributes of the length own property of F to the values
|
150
|
+
// specified in 15.3.5.1.
|
151
|
+
var boundArgs = [];
|
152
|
+
for (var i = 0; i < boundLength; i++) {
|
153
|
+
boundArgs.push("$" + i);
|
154
|
+
}
|
102
155
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
};
|
143
|
-
}
|
156
|
+
// XXX Build a dynamic function with desired amount of arguments is the only
|
157
|
+
// way to set the length property of a function.
|
158
|
+
// In environments where Content Security Policies enabled (Chrome extensions,
|
159
|
+
// for ex.) all use of eval or Function costructor throws an exception.
|
160
|
+
// However in all of these environments Function.prototype.bind exists
|
161
|
+
// and so this code will never be executed.
|
162
|
+
var bound = Function("binder", "return function (" + boundArgs.join(",") + "){return binder.apply(this,arguments)}")(binder);
|
163
|
+
|
164
|
+
if (target.prototype) {
|
165
|
+
Empty.prototype = target.prototype;
|
166
|
+
bound.prototype = new Empty();
|
167
|
+
// Clean up dangling references.
|
168
|
+
Empty.prototype = null;
|
169
|
+
}
|
170
|
+
|
171
|
+
// TODO
|
172
|
+
// 18. Set the [[Extensible]] internal property of F to true.
|
173
|
+
|
174
|
+
// TODO
|
175
|
+
// 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3).
|
176
|
+
// 20. Call the [[DefineOwnProperty]] internal method of F with
|
177
|
+
// arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]:
|
178
|
+
// thrower, [[Enumerable]]: false, [[Configurable]]: false}, and
|
179
|
+
// false.
|
180
|
+
// 21. Call the [[DefineOwnProperty]] internal method of F with
|
181
|
+
// arguments "arguments", PropertyDescriptor {[[Get]]: thrower,
|
182
|
+
// [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
|
183
|
+
// and false.
|
184
|
+
|
185
|
+
// TODO
|
186
|
+
// NOTE Function objects created using Function.prototype.bind do not
|
187
|
+
// have a prototype property or the [[Code]], [[FormalParameters]], and
|
188
|
+
// [[Scope]] internal properties.
|
189
|
+
// XXX can't delete prototype in pure-js.
|
190
|
+
|
191
|
+
// 22. Return F.
|
192
|
+
return bound;
|
193
|
+
};
|
194
|
+
}
|
144
195
|
|
145
|
-
// Shortcut to an often accessed properties, in order to avoid multiple
|
146
|
-
// dereference that costs universally.
|
147
196
|
// _Please note: Shortcuts are defined after `Function.prototype.bind` as we
|
148
197
|
// us it in defining shortcuts.
|
149
|
-
var
|
150
|
-
var prototypeOfArray = Array.prototype;
|
151
|
-
var prototypeOfObject = Object.prototype;
|
152
|
-
var _Array_slice_ = prototypeOfArray.slice;
|
153
|
-
// Having a toString local variable name breaks in Opera so use _toString.
|
154
|
-
var _toString = call.bind(prototypeOfObject.toString);
|
155
|
-
var owns = call.bind(prototypeOfObject.hasOwnProperty);
|
198
|
+
var owns = call.bind(prototypeOfObject.hasOwnProperty);
|
156
199
|
|
157
200
|
// If JS engine supports accessors creating shortcuts.
|
158
|
-
var defineGetter;
|
159
|
-
var defineSetter;
|
160
|
-
var lookupGetter;
|
161
|
-
var lookupSetter;
|
162
|
-
var supportsAccessors;
|
163
|
-
if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
}
|
201
|
+
var defineGetter;
|
202
|
+
var defineSetter;
|
203
|
+
var lookupGetter;
|
204
|
+
var lookupSetter;
|
205
|
+
var supportsAccessors;
|
206
|
+
if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
|
207
|
+
defineGetter = call.bind(prototypeOfObject.__defineGetter__);
|
208
|
+
defineSetter = call.bind(prototypeOfObject.__defineSetter__);
|
209
|
+
lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
|
210
|
+
lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
|
211
|
+
}
|
169
212
|
|
170
213
|
//
|
171
214
|
// Array
|
@@ -174,127 +217,63 @@ if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
|
|
174
217
|
|
175
218
|
// ES5 15.4.4.12
|
176
219
|
// http://es5.github.com/#x15.4.4.12
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
}()) {//IE 6/7
|
209
|
-
Array.prototype.splice = function(start, deleteCount) {
|
210
|
-
if (!arguments.length) {
|
211
|
-
return [];
|
212
|
-
} else {
|
213
|
-
return array_splice.apply(this, [
|
214
|
-
start === void 0 ? 0 : start,
|
215
|
-
deleteCount === void 0 ? (this.length - start) : deleteCount
|
216
|
-
].concat(_Array_slice_.call(arguments, 2)))
|
217
|
-
}
|
218
|
-
};
|
219
|
-
}
|
220
|
-
else {//IE8
|
221
|
-
Array.prototype.splice = function(start, deleteCount) {
|
222
|
-
var result
|
223
|
-
, args = _Array_slice_.call(arguments, 2)
|
224
|
-
, addElementsCount = args.length
|
225
|
-
;
|
226
|
-
|
227
|
-
if(!arguments.length) {
|
228
|
-
return [];
|
229
|
-
}
|
230
|
-
|
231
|
-
if(start === void 0) { // default
|
232
|
-
start = 0;
|
233
|
-
}
|
234
|
-
if(deleteCount === void 0) { // default
|
235
|
-
deleteCount = this.length - start;
|
236
|
-
}
|
237
|
-
|
238
|
-
if(addElementsCount > 0) {
|
239
|
-
if(deleteCount <= 0) {
|
240
|
-
if(start == this.length) { // tiny optimisation #1
|
241
|
-
this.push.apply(this, args);
|
242
|
-
return [];
|
243
|
-
}
|
244
|
-
|
245
|
-
if(start == 0) { // tiny optimisation #2
|
246
|
-
this.unshift.apply(this, args);
|
247
|
-
return [];
|
248
|
-
}
|
249
|
-
}
|
250
|
-
|
251
|
-
// Array.prototype.splice implementation
|
252
|
-
result = _Array_slice_.call(this, start, start + deleteCount);// delete part
|
253
|
-
args.push.apply(args, _Array_slice_.call(this, start + deleteCount, this.length));// right part
|
254
|
-
args.unshift.apply(args, _Array_slice_.call(this, 0, start));// left part
|
255
|
-
|
256
|
-
// delete all items from this array and replace it to 'left part' + _Array_slice_.call(arguments, 2) + 'right part'
|
257
|
-
args.unshift(0, this.length);
|
258
|
-
|
259
|
-
array_splice.apply(this, args);
|
260
|
-
|
261
|
-
return result;
|
262
|
-
}
|
263
|
-
|
264
|
-
return array_splice.call(this, start, deleteCount);
|
265
|
-
}
|
266
|
-
|
267
|
-
}
|
268
|
-
}
|
220
|
+
var spliceWorksWithEmptyObject = (function () {
|
221
|
+
var obj = {};
|
222
|
+
Array.prototype.splice.call(obj, 0, 0, 1);
|
223
|
+
return obj.length === 1;
|
224
|
+
}());
|
225
|
+
var omittingSecondSpliceArgIsNoop = [1].splice(0).length === 0;
|
226
|
+
var spliceNoopReturnsEmptyArray = (function () {
|
227
|
+
var a = [1, 2];
|
228
|
+
var result = a.splice();
|
229
|
+
return a.length === 2 && isArray(result) && result.length === 0;
|
230
|
+
}());
|
231
|
+
if (spliceNoopReturnsEmptyArray) {
|
232
|
+
// Safari 5.0 bug where .split() returns undefined
|
233
|
+
Array.prototype.splice = function splice(start, deleteCount) {
|
234
|
+
if (arguments.length === 0) { return []; }
|
235
|
+
else { return array_splice.apply(this, arguments); }
|
236
|
+
};
|
237
|
+
}
|
238
|
+
if (!omittingSecondSpliceArgIsNoop || !spliceWorksWithEmptyObject) {
|
239
|
+
Array.prototype.splice = function splice(start, deleteCount) {
|
240
|
+
if (arguments.length === 0) { return []; }
|
241
|
+
var args = arguments;
|
242
|
+
this.length = Math.max(toInteger(this.length), 0);
|
243
|
+
if (arguments.length > 0 && typeof deleteCount !== 'number') {
|
244
|
+
args = _Array_slice_.call(arguments);
|
245
|
+
if (args.length < 2) { args.push(toInteger(deleteCount)); }
|
246
|
+
else { args[1] = toInteger(deleteCount); }
|
247
|
+
}
|
248
|
+
return array_splice.apply(this, args);
|
249
|
+
};
|
250
|
+
}
|
269
251
|
|
270
252
|
// ES5 15.4.4.12
|
271
253
|
// http://es5.github.com/#x15.4.4.13
|
272
254
|
// Return len+argCount.
|
273
255
|
// [bugfix, ielt8]
|
274
|
-
// IE < 8 bug: [].unshift(0)
|
275
|
-
if ([].unshift(0)
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
}
|
256
|
+
// IE < 8 bug: [].unshift(0) === undefined but should be "1"
|
257
|
+
if ([].unshift(0) !== 1) {
|
258
|
+
Array.prototype.unshift = function () {
|
259
|
+
array_unshift.apply(this, arguments);
|
260
|
+
return this.length;
|
261
|
+
};
|
262
|
+
}
|
282
263
|
|
283
264
|
// ES5 15.4.3.2
|
284
265
|
// http://es5.github.com/#x15.4.3.2
|
285
266
|
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray
|
286
|
-
if (!Array.isArray) {
|
287
|
-
|
288
|
-
|
289
|
-
};
|
290
|
-
}
|
267
|
+
if (!Array.isArray) {
|
268
|
+
Array.isArray = isArray;
|
269
|
+
}
|
291
270
|
|
292
271
|
// The IsCallable() check in the Array functions
|
293
272
|
// has been replaced with a strict check on the
|
294
273
|
// internal class of the object to trap cases where
|
295
274
|
// the provided function was actually a regular
|
296
275
|
// expression literal, which in V8 and
|
297
|
-
// JavaScriptCore is a typeof "function".
|
276
|
+
// JavaScriptCore is a typeof "function". Only in
|
298
277
|
// V8 are regular expression literals permitted as
|
299
278
|
// reduce parameters, so it is desirable in the
|
300
279
|
// general case for the shim to match the more
|
@@ -307,302 +286,328 @@ if (!Array.isArray) {
|
|
307
286
|
|
308
287
|
// Check failure of by-index access of string characters (IE < 9)
|
309
288
|
// and failure of `0 in boxedString` (Rhino)
|
310
|
-
var boxedString = Object("a")
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
289
|
+
var boxedString = Object("a");
|
290
|
+
var splitString = boxedString[0] !== "a" || !(0 in boxedString);
|
291
|
+
|
292
|
+
var properlyBoxesContext = function properlyBoxed(method) {
|
293
|
+
// Check node 0.6.21 bug where third parameter is not boxed
|
294
|
+
var properlyBoxesNonStrict = true;
|
295
|
+
var properlyBoxesStrict = true;
|
296
|
+
if (method) {
|
297
|
+
method.call('foo', function (_, __, context) {
|
298
|
+
if (typeof context !== 'object') { properlyBoxesNonStrict = false; }
|
299
|
+
});
|
300
|
+
|
301
|
+
method.call([1], function () {
|
302
|
+
'use strict';
|
303
|
+
properlyBoxesStrict = typeof this === 'string';
|
304
|
+
}, 'x');
|
305
|
+
}
|
306
|
+
return !!method && properlyBoxesNonStrict && properlyBoxesStrict;
|
307
|
+
};
|
327
308
|
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
309
|
+
if (!Array.prototype.forEach || !properlyBoxesContext(Array.prototype.forEach)) {
|
310
|
+
Array.prototype.forEach = function forEach(fun /*, thisp*/) {
|
311
|
+
var object = toObject(this),
|
312
|
+
self = splitString && _toString.call(this) === "[object String]" ?
|
313
|
+
this.split("") :
|
314
|
+
object,
|
315
|
+
thisp = arguments[1],
|
316
|
+
i = -1,
|
317
|
+
length = self.length >>> 0;
|
318
|
+
|
319
|
+
// If no callback function or if callback is not a callable function
|
320
|
+
if (!isFunction(fun)) {
|
321
|
+
throw new TypeError(); // TODO message
|
322
|
+
}
|
323
|
+
|
324
|
+
while (++i < length) {
|
325
|
+
if (i in self) {
|
326
|
+
// Invoke the callback function with call, passing arguments:
|
327
|
+
// context, property value, property key, thisArg object
|
328
|
+
// context
|
329
|
+
fun.call(thisp, self[i], i, object);
|
330
|
+
}
|
331
|
+
}
|
332
|
+
};
|
333
|
+
}
|
338
334
|
|
339
335
|
// ES5 15.4.4.19
|
340
336
|
// http://es5.github.com/#x15.4.4.19
|
341
337
|
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
|
342
|
-
if (!Array.prototype.map) {
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
338
|
+
if (!Array.prototype.map || !properlyBoxesContext(Array.prototype.map)) {
|
339
|
+
Array.prototype.map = function map(fun /*, thisp*/) {
|
340
|
+
var object = toObject(this),
|
341
|
+
self = splitString && _toString.call(this) === "[object String]" ?
|
342
|
+
this.split("") :
|
343
|
+
object,
|
344
|
+
length = self.length >>> 0,
|
345
|
+
result = Array(length),
|
346
|
+
thisp = arguments[1];
|
347
|
+
|
348
|
+
// If no callback function or if callback is not a callable function
|
349
|
+
if (!isFunction(fun)) {
|
350
|
+
throw new TypeError(fun + " is not a function");
|
351
|
+
}
|
356
352
|
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
}
|
353
|
+
for (var i = 0; i < length; i++) {
|
354
|
+
if (i in self) {
|
355
|
+
result[i] = fun.call(thisp, self[i], i, object);
|
356
|
+
}
|
357
|
+
}
|
358
|
+
return result;
|
359
|
+
};
|
360
|
+
}
|
364
361
|
|
365
362
|
// ES5 15.4.4.20
|
366
363
|
// http://es5.github.com/#x15.4.4.20
|
367
364
|
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter
|
368
|
-
if (!Array.prototype.filter) {
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
365
|
+
if (!Array.prototype.filter || !properlyBoxesContext(Array.prototype.filter)) {
|
366
|
+
Array.prototype.filter = function filter(fun /*, thisp */) {
|
367
|
+
var object = toObject(this),
|
368
|
+
self = splitString && _toString.call(this) === "[object String]" ?
|
369
|
+
this.split("") :
|
370
|
+
object,
|
371
|
+
length = self.length >>> 0,
|
372
|
+
result = [],
|
373
|
+
value,
|
374
|
+
thisp = arguments[1];
|
375
|
+
|
376
|
+
// If no callback function or if callback is not a callable function
|
377
|
+
if (!isFunction(fun)) {
|
378
|
+
throw new TypeError(fun + " is not a function");
|
379
|
+
}
|
383
380
|
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
}
|
381
|
+
for (var i = 0; i < length; i++) {
|
382
|
+
if (i in self) {
|
383
|
+
value = self[i];
|
384
|
+
if (fun.call(thisp, value, i, object)) {
|
385
|
+
result.push(value);
|
386
|
+
}
|
387
|
+
}
|
388
|
+
}
|
389
|
+
return result;
|
390
|
+
};
|
391
|
+
}
|
395
392
|
|
396
393
|
// ES5 15.4.4.16
|
397
394
|
// http://es5.github.com/#x15.4.4.16
|
398
395
|
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every
|
399
|
-
if (!Array.prototype.every) {
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
396
|
+
if (!Array.prototype.every || !properlyBoxesContext(Array.prototype.every)) {
|
397
|
+
Array.prototype.every = function every(fun /*, thisp */) {
|
398
|
+
var object = toObject(this),
|
399
|
+
self = splitString && _toString.call(this) === "[object String]" ?
|
400
|
+
this.split("") :
|
401
|
+
object,
|
402
|
+
length = self.length >>> 0,
|
403
|
+
thisp = arguments[1];
|
404
|
+
|
405
|
+
// If no callback function or if callback is not a callable function
|
406
|
+
if (!isFunction(fun)) {
|
407
|
+
throw new TypeError(fun + " is not a function");
|
408
|
+
}
|
412
409
|
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
}
|
410
|
+
for (var i = 0; i < length; i++) {
|
411
|
+
if (i in self && !fun.call(thisp, self[i], i, object)) {
|
412
|
+
return false;
|
413
|
+
}
|
414
|
+
}
|
415
|
+
return true;
|
416
|
+
};
|
417
|
+
}
|
421
418
|
|
422
419
|
// ES5 15.4.4.17
|
423
420
|
// http://es5.github.com/#x15.4.4.17
|
424
421
|
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some
|
425
|
-
if (!Array.prototype.some) {
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
422
|
+
if (!Array.prototype.some || !properlyBoxesContext(Array.prototype.some)) {
|
423
|
+
Array.prototype.some = function some(fun /*, thisp */) {
|
424
|
+
var object = toObject(this),
|
425
|
+
self = splitString && _toString.call(this) === "[object String]" ?
|
426
|
+
this.split("") :
|
427
|
+
object,
|
428
|
+
length = self.length >>> 0,
|
429
|
+
thisp = arguments[1];
|
430
|
+
|
431
|
+
// If no callback function or if callback is not a callable function
|
432
|
+
if (!isFunction(fun)) {
|
433
|
+
throw new TypeError(fun + " is not a function");
|
434
|
+
}
|
438
435
|
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
}
|
436
|
+
for (var i = 0; i < length; i++) {
|
437
|
+
if (i in self && fun.call(thisp, self[i], i, object)) {
|
438
|
+
return true;
|
439
|
+
}
|
440
|
+
}
|
441
|
+
return false;
|
442
|
+
};
|
443
|
+
}
|
447
444
|
|
448
445
|
// ES5 15.4.4.21
|
449
446
|
// http://es5.github.com/#x15.4.4.21
|
450
447
|
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
448
|
+
var reduceCoercesToObject = false;
|
449
|
+
if (Array.prototype.reduce) {
|
450
|
+
reduceCoercesToObject = typeof Array.prototype.reduce.call('es5', function (_, __, ___, list) { return list; }) === 'object';
|
451
|
+
}
|
452
|
+
if (!Array.prototype.reduce || !reduceCoercesToObject) {
|
453
|
+
Array.prototype.reduce = function reduce(fun /*, initial*/) {
|
454
|
+
var object = toObject(this),
|
455
|
+
self = splitString && _toString.call(this) === "[object String]" ?
|
456
|
+
this.split("") :
|
457
|
+
object,
|
458
|
+
length = self.length >>> 0;
|
459
|
+
|
460
|
+
// If no callback function or if callback is not a callable function
|
461
|
+
if (!isFunction(fun)) {
|
462
|
+
throw new TypeError(fun + " is not a function");
|
463
|
+
}
|
463
464
|
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
465
|
+
// no value to return if no initial value and an empty array
|
466
|
+
if (!length && arguments.length === 1) {
|
467
|
+
throw new TypeError("reduce of empty array with no initial value");
|
468
|
+
}
|
468
469
|
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
// if array contains no values, no initial value to return
|
481
|
-
if (++i >= length) {
|
482
|
-
throw new TypeError("reduce of empty array with no initial value");
|
483
|
-
}
|
484
|
-
} while (true);
|
485
|
-
}
|
470
|
+
var i = 0;
|
471
|
+
var result;
|
472
|
+
if (arguments.length >= 2) {
|
473
|
+
result = arguments[1];
|
474
|
+
} else {
|
475
|
+
do {
|
476
|
+
if (i in self) {
|
477
|
+
result = self[i++];
|
478
|
+
break;
|
479
|
+
}
|
486
480
|
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
481
|
+
// if array contains no values, no initial value to return
|
482
|
+
if (++i >= length) {
|
483
|
+
throw new TypeError("reduce of empty array with no initial value");
|
484
|
+
}
|
485
|
+
} while (true);
|
486
|
+
}
|
492
487
|
|
493
|
-
|
494
|
-
|
495
|
-
|
488
|
+
for (; i < length; i++) {
|
489
|
+
if (i in self) {
|
490
|
+
result = fun.call(void 0, result, self[i], i, object);
|
491
|
+
}
|
492
|
+
}
|
493
|
+
|
494
|
+
return result;
|
495
|
+
};
|
496
|
+
}
|
496
497
|
|
497
498
|
// ES5 15.4.4.22
|
498
499
|
// http://es5.github.com/#x15.4.4.22
|
499
500
|
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
501
|
+
var reduceRightCoercesToObject = false;
|
502
|
+
if (Array.prototype.reduceRight) {
|
503
|
+
reduceRightCoercesToObject = typeof Array.prototype.reduceRight.call('es5', function (_, __, ___, list) { return list; }) === 'object';
|
504
|
+
}
|
505
|
+
if (!Array.prototype.reduceRight || !reduceRightCoercesToObject) {
|
506
|
+
Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
|
507
|
+
var object = toObject(this),
|
508
|
+
self = splitString && _toString.call(this) === "[object String]" ?
|
509
|
+
this.split("") :
|
510
|
+
object,
|
511
|
+
length = self.length >>> 0;
|
512
|
+
|
513
|
+
// If no callback function or if callback is not a callable function
|
514
|
+
if (!isFunction(fun)) {
|
515
|
+
throw new TypeError(fun + " is not a function");
|
516
|
+
}
|
512
517
|
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
518
|
+
// no value to return if no initial value, empty array
|
519
|
+
if (!length && arguments.length === 1) {
|
520
|
+
throw new TypeError("reduceRight of empty array with no initial value");
|
521
|
+
}
|
517
522
|
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
// if array contains no values, no initial value to return
|
529
|
-
if (--i < 0) {
|
530
|
-
throw new TypeError("reduceRight of empty array with no initial value");
|
531
|
-
}
|
532
|
-
} while (true);
|
533
|
-
}
|
523
|
+
var result, i = length - 1;
|
524
|
+
if (arguments.length >= 2) {
|
525
|
+
result = arguments[1];
|
526
|
+
} else {
|
527
|
+
do {
|
528
|
+
if (i in self) {
|
529
|
+
result = self[i--];
|
530
|
+
break;
|
531
|
+
}
|
534
532
|
|
535
|
-
|
536
|
-
|
537
|
-
|
533
|
+
// if array contains no values, no initial value to return
|
534
|
+
if (--i < 0) {
|
535
|
+
throw new TypeError("reduceRight of empty array with no initial value");
|
536
|
+
}
|
537
|
+
} while (true);
|
538
|
+
}
|
538
539
|
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
}
|
543
|
-
} while (i--);
|
540
|
+
if (i < 0) {
|
541
|
+
return result;
|
542
|
+
}
|
544
543
|
|
545
|
-
|
546
|
-
|
547
|
-
|
544
|
+
do {
|
545
|
+
if (i in self) {
|
546
|
+
result = fun.call(void 0, result, self[i], i, object);
|
547
|
+
}
|
548
|
+
} while (i--);
|
549
|
+
|
550
|
+
return result;
|
551
|
+
};
|
552
|
+
}
|
548
553
|
|
549
554
|
// ES5 15.4.4.14
|
550
555
|
// http://es5.github.com/#x15.4.4.14
|
551
556
|
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf
|
552
|
-
if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2)
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
557
|
+
if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) !== -1)) {
|
558
|
+
Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
|
559
|
+
var self = splitString && _toString.call(this) === "[object String]" ?
|
560
|
+
this.split("") :
|
561
|
+
toObject(this),
|
562
|
+
length = self.length >>> 0;
|
563
|
+
|
564
|
+
if (!length) {
|
565
|
+
return -1;
|
566
|
+
}
|
562
567
|
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
568
|
+
var i = 0;
|
569
|
+
if (arguments.length > 1) {
|
570
|
+
i = toInteger(arguments[1]);
|
571
|
+
}
|
567
572
|
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
}
|
573
|
+
// handle negative indices
|
574
|
+
i = i >= 0 ? i : Math.max(0, length + i);
|
575
|
+
for (; i < length; i++) {
|
576
|
+
if (i in self && self[i] === sought) {
|
577
|
+
return i;
|
578
|
+
}
|
579
|
+
}
|
580
|
+
return -1;
|
581
|
+
};
|
582
|
+
}
|
578
583
|
|
579
584
|
// ES5 15.4.4.15
|
580
585
|
// http://es5.github.com/#x15.4.4.15
|
581
586
|
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf
|
582
|
-
if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3)
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
}
|
587
|
+
if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) !== -1)) {
|
588
|
+
Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
|
589
|
+
var self = splitString && _toString.call(this) === "[object String]" ?
|
590
|
+
this.split("") :
|
591
|
+
toObject(this),
|
592
|
+
length = self.length >>> 0;
|
593
|
+
|
594
|
+
if (!length) {
|
595
|
+
return -1;
|
596
|
+
}
|
597
|
+
var i = length - 1;
|
598
|
+
if (arguments.length > 1) {
|
599
|
+
i = Math.min(i, toInteger(arguments[1]));
|
600
|
+
}
|
601
|
+
// handle negative indices
|
602
|
+
i = i >= 0 ? i : length - Math.abs(i);
|
603
|
+
for (; i >= 0; i--) {
|
604
|
+
if (i in self && sought === self[i]) {
|
605
|
+
return i;
|
606
|
+
}
|
607
|
+
}
|
608
|
+
return -1;
|
609
|
+
};
|
610
|
+
}
|
606
611
|
|
607
612
|
//
|
608
613
|
// Object
|
@@ -611,52 +616,71 @@ if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
|
|
611
616
|
|
612
617
|
// ES5 15.2.3.14
|
613
618
|
// http://es5.github.com/#x15.2.3.14
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
var keys = [];
|
642
|
-
for (var name in object) {
|
643
|
-
if (owns(object, name)) {
|
644
|
-
keys.push(name);
|
645
|
-
}
|
646
|
-
}
|
619
|
+
var keysWorksWithArguments = Object.keys && (function () {
|
620
|
+
return Object.keys(arguments).length === 2;
|
621
|
+
}(1, 2));
|
622
|
+
if (!Object.keys) {
|
623
|
+
// http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
|
624
|
+
var hasDontEnumBug = !({'toString': null}).propertyIsEnumerable('toString'),
|
625
|
+
hasProtoEnumBug = (function () {}).propertyIsEnumerable('prototype'),
|
626
|
+
dontEnums = [
|
627
|
+
"toString",
|
628
|
+
"toLocaleString",
|
629
|
+
"valueOf",
|
630
|
+
"hasOwnProperty",
|
631
|
+
"isPrototypeOf",
|
632
|
+
"propertyIsEnumerable",
|
633
|
+
"constructor"
|
634
|
+
],
|
635
|
+
dontEnumsLength = dontEnums.length;
|
636
|
+
|
637
|
+
Object.keys = function keys(object) {
|
638
|
+
var isFn = isFunction(object),
|
639
|
+
isArgs = isArguments(object),
|
640
|
+
isObject = object !== null && typeof object === 'object',
|
641
|
+
isString = isObject && _toString.call(object) === '[object String]';
|
642
|
+
|
643
|
+
if (!isObject && !isFn && !isArgs) {
|
644
|
+
throw new TypeError("Object.keys called on a non-object");
|
645
|
+
}
|
647
646
|
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
647
|
+
var theKeys = [];
|
648
|
+
var skipProto = hasProtoEnumBug && isFn;
|
649
|
+
if (isString || isArgs) {
|
650
|
+
for (var i = 0; i < object.length; ++i) {
|
651
|
+
theKeys.push(String(i));
|
652
|
+
}
|
653
|
+
} else {
|
654
|
+
for (var name in object) {
|
655
|
+
if (!(skipProto && name === 'prototype') && owns(object, name)) {
|
656
|
+
theKeys.push(String(name));
|
657
|
+
}
|
658
|
+
}
|
659
|
+
}
|
658
660
|
|
659
|
-
|
661
|
+
if (hasDontEnumBug) {
|
662
|
+
var ctor = object.constructor,
|
663
|
+
skipConstructor = ctor && ctor.prototype === object;
|
664
|
+
for (var j = 0; j < dontEnumsLength; j++) {
|
665
|
+
var dontEnum = dontEnums[j];
|
666
|
+
if (!(skipConstructor && dontEnum === 'constructor') && owns(object, dontEnum)) {
|
667
|
+
theKeys.push(dontEnum);
|
668
|
+
}
|
669
|
+
}
|
670
|
+
}
|
671
|
+
return theKeys;
|
672
|
+
};
|
673
|
+
} else if (!keysWorksWithArguments) {
|
674
|
+
// Safari 5.0 bug
|
675
|
+
var originalKeys = Object.keys;
|
676
|
+
Object.keys = function keys(object) {
|
677
|
+
if (isArguments(object)) {
|
678
|
+
return originalKeys(Array.prototype.slice.call(object));
|
679
|
+
} else {
|
680
|
+
return originalKeys(object);
|
681
|
+
}
|
682
|
+
};
|
683
|
+
}
|
660
684
|
|
661
685
|
//
|
662
686
|
// Date
|
@@ -670,256 +694,263 @@ if (!Object.keys) {
|
|
670
694
|
// string format defined in 15.9.1.15. All fields are present in the String.
|
671
695
|
// The time zone is always UTC, denoted by the suffix Z. If the time value of
|
672
696
|
// this object is not a finite Number a RangeError exception is thrown.
|
673
|
-
var negativeDate = -62198755200000,
|
674
|
-
|
675
|
-
if (
|
676
|
-
|
677
|
-
|
678
|
-
) {
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
697
|
+
var negativeDate = -62198755200000,
|
698
|
+
negativeYearString = "-000001";
|
699
|
+
if (
|
700
|
+
!Date.prototype.toISOString ||
|
701
|
+
(new Date(negativeDate).toISOString().indexOf(negativeYearString) === -1)
|
702
|
+
) {
|
703
|
+
Date.prototype.toISOString = function toISOString() {
|
704
|
+
var result, length, value, year, month;
|
705
|
+
if (!isFinite(this)) {
|
706
|
+
throw new RangeError("Date.prototype.toISOString called on non-finite value.");
|
707
|
+
}
|
684
708
|
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
};
|
717
|
-
}
|
709
|
+
year = this.getUTCFullYear();
|
710
|
+
|
711
|
+
month = this.getUTCMonth();
|
712
|
+
// see https://github.com/es-shims/es5-shim/issues/111
|
713
|
+
year += Math.floor(month / 12);
|
714
|
+
month = (month % 12 + 12) % 12;
|
715
|
+
|
716
|
+
// the date time string format is specified in 15.9.1.15.
|
717
|
+
result = [month + 1, this.getUTCDate(), this.getUTCHours(), this.getUTCMinutes(), this.getUTCSeconds()];
|
718
|
+
year = (
|
719
|
+
(year < 0 ? "-" : (year > 9999 ? "+" : "")) +
|
720
|
+
("00000" + Math.abs(year)).slice(0 <= year && year <= 9999 ? -4 : -6)
|
721
|
+
);
|
722
|
+
|
723
|
+
length = result.length;
|
724
|
+
while (length--) {
|
725
|
+
value = result[length];
|
726
|
+
// pad months, days, hours, minutes, and seconds to have two
|
727
|
+
// digits.
|
728
|
+
if (value < 10) {
|
729
|
+
result[length] = "0" + value;
|
730
|
+
}
|
731
|
+
}
|
732
|
+
// pad milliseconds to have three digits.
|
733
|
+
return (
|
734
|
+
year + "-" + result.slice(0, 2).join("-") +
|
735
|
+
"T" + result.slice(2).join(":") + "." +
|
736
|
+
("000" + this.getUTCMilliseconds()).slice(-3) + "Z"
|
737
|
+
);
|
738
|
+
};
|
739
|
+
}
|
718
740
|
|
719
741
|
|
720
742
|
// ES5 15.9.5.44
|
721
743
|
// http://es5.github.com/#x15.9.5.44
|
722
744
|
// This function provides a String representation of a Date object for use by
|
723
745
|
// JSON.stringify (15.12.3).
|
724
|
-
var dateToJSONIsSupported = false;
|
725
|
-
try {
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
} catch (e) {
|
737
|
-
}
|
738
|
-
if (!dateToJSONIsSupported) {
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
}
|
746
|
+
var dateToJSONIsSupported = false;
|
747
|
+
try {
|
748
|
+
dateToJSONIsSupported = (
|
749
|
+
Date.prototype.toJSON &&
|
750
|
+
new Date(NaN).toJSON() === null &&
|
751
|
+
new Date(negativeDate).toJSON().indexOf(negativeYearString) !== -1 &&
|
752
|
+
Date.prototype.toJSON.call({ // generic
|
753
|
+
toISOString: function () {
|
754
|
+
return true;
|
755
|
+
}
|
756
|
+
})
|
757
|
+
);
|
758
|
+
} catch (e) {
|
759
|
+
}
|
760
|
+
if (!dateToJSONIsSupported) {
|
761
|
+
Date.prototype.toJSON = function toJSON(key) {
|
762
|
+
// When the toJSON method is called with argument key, the following
|
763
|
+
// steps are taken:
|
764
|
+
|
765
|
+
// 1. Let O be the result of calling ToObject, giving it the this
|
766
|
+
// value as its argument.
|
767
|
+
// 2. Let tv be toPrimitive(O, hint Number).
|
768
|
+
var o = Object(this),
|
769
|
+
tv = toPrimitive(o),
|
770
|
+
toISO;
|
771
|
+
// 3. If tv is a Number and is not finite, return null.
|
772
|
+
if (typeof tv === "number" && !isFinite(tv)) {
|
773
|
+
return null;
|
774
|
+
}
|
775
|
+
// 4. Let toISO be the result of calling the [[Get]] internal method of
|
776
|
+
// O with argument "toISOString".
|
777
|
+
toISO = o.toISOString;
|
778
|
+
// 5. If IsCallable(toISO) is false, throw a TypeError exception.
|
779
|
+
if (typeof toISO !== "function") {
|
780
|
+
throw new TypeError("toISOString property is not callable");
|
781
|
+
}
|
782
|
+
// 6. Return the result of calling the [[Call]] internal method of
|
783
|
+
// toISO with O as the this value and an empty argument list.
|
784
|
+
return toISO.call(o);
|
785
|
+
|
786
|
+
// NOTE 1 The argument is ignored.
|
787
|
+
|
788
|
+
// NOTE 2 The toJSON function is intentionally generic; it does not
|
789
|
+
// require that its this value be a Date object. Therefore, it can be
|
790
|
+
// transferred to other kinds of objects for use as a method. However,
|
791
|
+
// it does require that any such object have a toISOString method. An
|
792
|
+
// object is free to use the argument key to filter its
|
793
|
+
// stringification.
|
794
|
+
};
|
795
|
+
}
|
774
796
|
|
775
797
|
// ES5 15.9.4.2
|
776
798
|
// http://es5.github.com/#x15.9.4.2
|
777
799
|
// based on work shared by Daniel Friesen (dantman)
|
778
800
|
// http://gist.github.com/303249
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
801
|
+
var supportsExtendedYears = Date.parse('+033658-09-27T01:46:40.000Z') === 1e15;
|
802
|
+
var acceptsInvalidDates = !isNaN(Date.parse('2012-04-04T24:00:00.500Z')) || !isNaN(Date.parse('2012-11-31T23:59:59.000Z'));
|
803
|
+
var doesNotParseY2KNewYear = isNaN(Date.parse("2000-01-01T00:00:00.000Z"));
|
804
|
+
if (!Date.parse || doesNotParseY2KNewYear || acceptsInvalidDates || !supportsExtendedYears) {
|
805
|
+
// XXX global assignment won't work in embeddings that use
|
806
|
+
// an alternate object for the context.
|
807
|
+
Date = (function (NativeDate) {
|
808
|
+
|
809
|
+
// Date.length === 7
|
810
|
+
function Date(Y, M, D, h, m, s, ms) {
|
811
|
+
var length = arguments.length;
|
812
|
+
if (this instanceof NativeDate) {
|
813
|
+
var date = length === 1 && String(Y) === Y ? // isString(Y)
|
814
|
+
// We explicitly pass it through parse:
|
815
|
+
new NativeDate(Date.parse(Y)) :
|
816
|
+
// We have to manually make calls depending on argument
|
817
|
+
// length here
|
818
|
+
length >= 7 ? new NativeDate(Y, M, D, h, m, s, ms) :
|
819
|
+
length >= 6 ? new NativeDate(Y, M, D, h, m, s) :
|
820
|
+
length >= 5 ? new NativeDate(Y, M, D, h, m) :
|
821
|
+
length >= 4 ? new NativeDate(Y, M, D, h) :
|
822
|
+
length >= 3 ? new NativeDate(Y, M, D) :
|
823
|
+
length >= 2 ? new NativeDate(Y, M) :
|
824
|
+
length >= 1 ? new NativeDate(Y) :
|
825
|
+
new NativeDate();
|
826
|
+
// Prevent mixups with unfixed Date object
|
827
|
+
date.constructor = Date;
|
828
|
+
return date;
|
829
|
+
}
|
830
|
+
return NativeDate.apply(this, arguments);
|
831
|
+
}
|
807
832
|
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
833
|
+
// 15.9.1.15 Date Time String Format.
|
834
|
+
var isoDateExpression = new RegExp("^" +
|
835
|
+
"(\\d{4}|[\+\-]\\d{6})" + // four-digit year capture or sign +
|
836
|
+
// 6-digit extended year
|
837
|
+
"(?:-(\\d{2})" + // optional month capture
|
838
|
+
"(?:-(\\d{2})" + // optional day capture
|
839
|
+
"(?:" + // capture hours:minutes:seconds.milliseconds
|
840
|
+
"T(\\d{2})" + // hours capture
|
841
|
+
":(\\d{2})" + // minutes capture
|
842
|
+
"(?:" + // optional :seconds.milliseconds
|
843
|
+
":(\\d{2})" + // seconds capture
|
844
|
+
"(?:(\\.\\d{1,}))?" + // milliseconds capture
|
845
|
+
")?" +
|
846
|
+
"(" + // capture UTC offset component
|
847
|
+
"Z|" + // UTC capture
|
848
|
+
"(?:" + // offset specifier +/-hours:minutes
|
849
|
+
"([-+])" + // sign capture
|
850
|
+
"(\\d{2})" + // hours offset capture
|
851
|
+
":(\\d{2})" + // minutes offset capture
|
852
|
+
")" +
|
853
|
+
")?)?)?)?" +
|
854
|
+
"$");
|
855
|
+
|
856
|
+
var months = [
|
857
|
+
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
|
858
|
+
];
|
859
|
+
|
860
|
+
function dayFromMonth(year, month) {
|
861
|
+
var t = month > 1 ? 1 : 0;
|
862
|
+
return (
|
863
|
+
months[month] +
|
864
|
+
Math.floor((year - 1969 + t) / 4) -
|
865
|
+
Math.floor((year - 1901 + t) / 100) +
|
866
|
+
Math.floor((year - 1601 + t) / 400) +
|
867
|
+
365 * (year - 1970)
|
868
|
+
);
|
869
|
+
}
|
845
870
|
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
}
|
871
|
+
function toUTC(t) {
|
872
|
+
return Number(new NativeDate(1970, 0, 1, 0, 0, 0, t));
|
873
|
+
}
|
850
874
|
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
Date.prototype.constructor = Date;
|
856
|
-
|
857
|
-
// Upgrade Date.parse to handle simplified ISO 8601 strings
|
858
|
-
Date.parse = function parse(string) {
|
859
|
-
var match = isoDateExpression.exec(string);
|
860
|
-
if (match) {
|
861
|
-
// parse months, days, hours, minutes, seconds, and milliseconds
|
862
|
-
// provide default values if necessary
|
863
|
-
// parse the UTC offset component
|
864
|
-
var year = Number(match[1]),
|
865
|
-
month = Number(match[2] || 1) - 1,
|
866
|
-
day = Number(match[3] || 1) - 1,
|
867
|
-
hour = Number(match[4] || 0),
|
868
|
-
minute = Number(match[5] || 0),
|
869
|
-
second = Number(match[6] || 0),
|
870
|
-
millisecond = Math.floor(Number(match[7] || 0) * 1000),
|
871
|
-
// When time zone is missed, local offset should be used
|
872
|
-
// (ES 5.1 bug)
|
873
|
-
// see https://bugs.ecmascript.org/show_bug.cgi?id=112
|
874
|
-
offset = !match[4] || match[8] ?
|
875
|
-
0 : Number(new NativeDate(1970, 0)),
|
876
|
-
signOffset = match[9] === "-" ? 1 : -1,
|
877
|
-
hourOffset = Number(match[10] || 0),
|
878
|
-
minuteOffset = Number(match[11] || 0),
|
879
|
-
result;
|
880
|
-
if (
|
881
|
-
hour < (
|
882
|
-
minute > 0 || second > 0 || millisecond > 0 ?
|
883
|
-
24 : 25
|
884
|
-
) &&
|
885
|
-
minute < 60 && second < 60 && millisecond < 1000 &&
|
886
|
-
month > -1 && month < 12 && hourOffset < 24 &&
|
887
|
-
minuteOffset < 60 && // detect invalid offsets
|
888
|
-
day > -1 &&
|
889
|
-
day < (
|
890
|
-
dayFromMonth(year, month + 1) -
|
891
|
-
dayFromMonth(year, month)
|
892
|
-
)
|
893
|
-
) {
|
894
|
-
result = (
|
895
|
-
(dayFromMonth(year, month) + day) * 24 +
|
896
|
-
hour +
|
897
|
-
hourOffset * signOffset
|
898
|
-
) * 60;
|
899
|
-
result = (
|
900
|
-
(result + minute + minuteOffset * signOffset) * 60 +
|
901
|
-
second
|
902
|
-
) * 1000 + millisecond + offset;
|
903
|
-
if (-8.64e15 <= result && result <= 8.64e15) {
|
904
|
-
return result;
|
905
|
-
}
|
906
|
-
}
|
907
|
-
return NaN;
|
908
|
-
}
|
909
|
-
return NativeDate.parse.apply(this, arguments);
|
910
|
-
};
|
875
|
+
// Copy any custom methods a 3rd party library may have added
|
876
|
+
for (var key in NativeDate) {
|
877
|
+
Date[key] = NativeDate[key];
|
878
|
+
}
|
911
879
|
|
912
|
-
|
913
|
-
|
914
|
-
|
880
|
+
// Copy "native" methods explicitly; they may be non-enumerable
|
881
|
+
Date.now = NativeDate.now;
|
882
|
+
Date.UTC = NativeDate.UTC;
|
883
|
+
Date.prototype = NativeDate.prototype;
|
884
|
+
Date.prototype.constructor = Date;
|
885
|
+
|
886
|
+
// Upgrade Date.parse to handle simplified ISO 8601 strings
|
887
|
+
Date.parse = function parse(string) {
|
888
|
+
var match = isoDateExpression.exec(string);
|
889
|
+
if (match) {
|
890
|
+
// parse months, days, hours, minutes, seconds, and milliseconds
|
891
|
+
// provide default values if necessary
|
892
|
+
// parse the UTC offset component
|
893
|
+
var year = Number(match[1]),
|
894
|
+
month = Number(match[2] || 1) - 1,
|
895
|
+
day = Number(match[3] || 1) - 1,
|
896
|
+
hour = Number(match[4] || 0),
|
897
|
+
minute = Number(match[5] || 0),
|
898
|
+
second = Number(match[6] || 0),
|
899
|
+
millisecond = Math.floor(Number(match[7] || 0) * 1000),
|
900
|
+
// When time zone is missed, local offset should be used
|
901
|
+
// (ES 5.1 bug)
|
902
|
+
// see https://bugs.ecmascript.org/show_bug.cgi?id=112
|
903
|
+
isLocalTime = Boolean(match[4] && !match[8]),
|
904
|
+
signOffset = match[9] === "-" ? 1 : -1,
|
905
|
+
hourOffset = Number(match[10] || 0),
|
906
|
+
minuteOffset = Number(match[11] || 0),
|
907
|
+
result;
|
908
|
+
if (
|
909
|
+
hour < (
|
910
|
+
minute > 0 || second > 0 || millisecond > 0 ?
|
911
|
+
24 : 25
|
912
|
+
) &&
|
913
|
+
minute < 60 && second < 60 && millisecond < 1000 &&
|
914
|
+
month > -1 && month < 12 && hourOffset < 24 &&
|
915
|
+
minuteOffset < 60 && // detect invalid offsets
|
916
|
+
day > -1 &&
|
917
|
+
day < (
|
918
|
+
dayFromMonth(year, month + 1) -
|
919
|
+
dayFromMonth(year, month)
|
920
|
+
)
|
921
|
+
) {
|
922
|
+
result = (
|
923
|
+
(dayFromMonth(year, month) + day) * 24 +
|
924
|
+
hour +
|
925
|
+
hourOffset * signOffset
|
926
|
+
) * 60;
|
927
|
+
result = (
|
928
|
+
(result + minute + minuteOffset * signOffset) * 60 +
|
929
|
+
second
|
930
|
+
) * 1000 + millisecond;
|
931
|
+
if (isLocalTime) {
|
932
|
+
result = toUTC(result);
|
933
|
+
}
|
934
|
+
if (-8.64e15 <= result && result <= 8.64e15) {
|
935
|
+
return result;
|
936
|
+
}
|
937
|
+
}
|
938
|
+
return NaN;
|
939
|
+
}
|
940
|
+
return NativeDate.parse.apply(this, arguments);
|
941
|
+
};
|
942
|
+
|
943
|
+
return Date;
|
944
|
+
})(Date);
|
945
|
+
}
|
915
946
|
|
916
947
|
// ES5 15.9.4.4
|
917
948
|
// http://es5.github.com/#x15.9.4.4
|
918
|
-
if (!Date.now) {
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
}
|
949
|
+
if (!Date.now) {
|
950
|
+
Date.now = function now() {
|
951
|
+
return new Date().getTime();
|
952
|
+
};
|
953
|
+
}
|
923
954
|
|
924
955
|
|
925
956
|
//
|
@@ -929,152 +960,152 @@ if (!Date.now) {
|
|
929
960
|
|
930
961
|
// ES5.1 15.7.4.5
|
931
962
|
// http://es5.github.com/#x15.7.4.5
|
932
|
-
if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' || (0.9).toFixed(0) === '0' || (1.255).toFixed(2) !== '1.25' || (1000000000000000128).toFixed(0) !== "1000000000000000128") {
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
963
|
+
if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' || (0.9).toFixed(0) === '0' || (1.255).toFixed(2) !== '1.25' || (1000000000000000128).toFixed(0) !== "1000000000000000128") {
|
964
|
+
// Hide these variables and functions
|
965
|
+
(function () {
|
966
|
+
var base, size, data, i;
|
967
|
+
|
968
|
+
base = 1e7;
|
969
|
+
size = 6;
|
970
|
+
data = [0, 0, 0, 0, 0, 0];
|
971
|
+
|
972
|
+
function multiply(n, c) {
|
973
|
+
var i = -1;
|
974
|
+
while (++i < size) {
|
975
|
+
c += n * data[i];
|
976
|
+
data[i] = c % base;
|
977
|
+
c = Math.floor(c / base);
|
978
|
+
}
|
979
|
+
}
|
949
980
|
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
981
|
+
function divide(n) {
|
982
|
+
var i = size, c = 0;
|
983
|
+
while (--i >= 0) {
|
984
|
+
c += data[i];
|
985
|
+
data[i] = Math.floor(c / n);
|
986
|
+
c = (c % n) * base;
|
987
|
+
}
|
988
|
+
}
|
958
989
|
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
990
|
+
function numToString() {
|
991
|
+
var i = size;
|
992
|
+
var s = '';
|
993
|
+
while (--i >= 0) {
|
994
|
+
if (s !== '' || i === 0 || data[i] !== 0) {
|
995
|
+
var t = String(data[i]);
|
996
|
+
if (s === '') {
|
997
|
+
s = t;
|
998
|
+
} else {
|
999
|
+
s += '0000000'.slice(0, 7 - t.length) + t;
|
1000
|
+
}
|
1001
|
+
}
|
1002
|
+
}
|
1003
|
+
return s;
|
1004
|
+
}
|
974
1005
|
|
975
|
-
|
976
|
-
|
977
|
-
|
1006
|
+
function pow(x, n, acc) {
|
1007
|
+
return (n === 0 ? acc : (n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc)));
|
1008
|
+
}
|
978
1009
|
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
1010
|
+
function log(x) {
|
1011
|
+
var n = 0;
|
1012
|
+
while (x >= 4096) {
|
1013
|
+
n += 12;
|
1014
|
+
x /= 4096;
|
1015
|
+
}
|
1016
|
+
while (x >= 2) {
|
1017
|
+
n += 1;
|
1018
|
+
x /= 2;
|
1019
|
+
}
|
1020
|
+
return n;
|
1021
|
+
}
|
991
1022
|
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
}
|
1023
|
+
Number.prototype.toFixed = function toFixed(fractionDigits) {
|
1024
|
+
var f, x, s, m, e, z, j, k;
|
1025
|
+
|
1026
|
+
// Test for NaN and round fractionDigits down
|
1027
|
+
f = Number(fractionDigits);
|
1028
|
+
f = f !== f ? 0 : Math.floor(f);
|
1029
|
+
|
1030
|
+
if (f < 0 || f > 20) {
|
1031
|
+
throw new RangeError("Number.toFixed called with invalid number of decimals");
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
x = Number(this);
|
1035
|
+
|
1036
|
+
// Test for NaN
|
1037
|
+
if (x !== x) {
|
1038
|
+
return "NaN";
|
1039
|
+
}
|
1040
|
+
|
1041
|
+
// If it is too big or small, return the string value of the number
|
1042
|
+
if (x <= -1e21 || x >= 1e21) {
|
1043
|
+
return String(x);
|
1044
|
+
}
|
1045
|
+
|
1046
|
+
s = "";
|
1047
|
+
|
1048
|
+
if (x < 0) {
|
1049
|
+
s = "-";
|
1050
|
+
x = -x;
|
1051
|
+
}
|
1052
|
+
|
1053
|
+
m = "0";
|
1054
|
+
|
1055
|
+
if (x > 1e-21) {
|
1056
|
+
// 1e-21 < x < 1e21
|
1057
|
+
// -70 < log2(x) < 70
|
1058
|
+
e = log(x * pow(2, 69, 1)) - 69;
|
1059
|
+
z = (e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1));
|
1060
|
+
z *= 0x10000000000000; // Math.pow(2, 52);
|
1061
|
+
e = 52 - e;
|
1062
|
+
|
1063
|
+
// -18 < e < 122
|
1064
|
+
// x = z / 2 ^ e
|
1065
|
+
if (e > 0) {
|
1066
|
+
multiply(0, z);
|
1067
|
+
j = f;
|
1068
|
+
|
1069
|
+
while (j >= 7) {
|
1070
|
+
multiply(1e7, 0);
|
1071
|
+
j -= 7;
|
1072
|
+
}
|
1073
|
+
|
1074
|
+
multiply(pow(10, j, 1), 0);
|
1075
|
+
j = e - 1;
|
1076
|
+
|
1077
|
+
while (j >= 23) {
|
1078
|
+
divide(1 << 23);
|
1079
|
+
j -= 23;
|
1080
|
+
}
|
1081
|
+
|
1082
|
+
divide(1 << j);
|
1083
|
+
multiply(1, 1);
|
1084
|
+
divide(2);
|
1085
|
+
m = numToString();
|
1086
|
+
} else {
|
1087
|
+
multiply(0, z);
|
1088
|
+
multiply(1 << (-e), 0);
|
1089
|
+
m = numToString() + '0.00000000000000000000'.slice(2, 2 + f);
|
1090
|
+
}
|
1091
|
+
}
|
1092
|
+
|
1093
|
+
if (f > 0) {
|
1094
|
+
k = m.length;
|
1095
|
+
|
1096
|
+
if (k <= f) {
|
1097
|
+
m = s + '0.0000000000000000000'.slice(0, f - k + 2) + m;
|
1098
|
+
} else {
|
1099
|
+
m = s + m.slice(0, k - f) + '.' + m.slice(k - f);
|
1100
|
+
}
|
1101
|
+
} else {
|
1102
|
+
m = s + m;
|
1103
|
+
}
|
1104
|
+
|
1105
|
+
return m;
|
1106
|
+
};
|
1107
|
+
}());
|
1108
|
+
}
|
1078
1109
|
|
1079
1110
|
|
1080
1111
|
//
|
@@ -1082,7 +1113,6 @@ if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' || (0.9).toFix
|
|
1082
1113
|
// ======
|
1083
1114
|
//
|
1084
1115
|
|
1085
|
-
|
1086
1116
|
// ES5 15.5.4.14
|
1087
1117
|
// http://es5.github.com/#x15.5.4.14
|
1088
1118
|
|
@@ -1091,97 +1121,99 @@ if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' || (0.9).toFix
|
|
1091
1121
|
// do not perform the split correctly under obscure conditions.
|
1092
1122
|
// See http://blog.stevenlevithan.com/archives/cross-browser-split
|
1093
1123
|
// I've tested in many browsers and this seems to cover the deviant ones:
|
1094
|
-
//
|
1095
|
-
//
|
1096
|
-
//
|
1097
|
-
//
|
1098
|
-
//
|
1099
|
-
//
|
1100
|
-
|
1101
|
-
var string_split = String.prototype.split;
|
1102
|
-
if (
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
)
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1124
|
+
// 'ab'.split(/(?:ab)*/) should be ["", ""], not [""]
|
1125
|
+
// '.'.split(/(.?)(.?)/) should be ["", ".", "", ""], not ["", ""]
|
1126
|
+
// 'tesst'.split(/(s)*/) should be ["t", undefined, "e", "s", "t"], not
|
1127
|
+
// [undefined, "t", undefined, "e", ...]
|
1128
|
+
// ''.split(/.?/) should be [], not [""]
|
1129
|
+
// '.'.split(/()()/) should be ["."], not ["", "", "."]
|
1130
|
+
|
1131
|
+
var string_split = String.prototype.split;
|
1132
|
+
if (
|
1133
|
+
'ab'.split(/(?:ab)*/).length !== 2 ||
|
1134
|
+
'.'.split(/(.?)(.?)/).length !== 4 ||
|
1135
|
+
'tesst'.split(/(s)*/)[1] === "t" ||
|
1136
|
+
'test'.split(/(?:)/, -1).length !== 4 ||
|
1137
|
+
''.split(/.?/).length ||
|
1138
|
+
'.'.split(/()()/).length > 1
|
1139
|
+
) {
|
1140
|
+
(function () {
|
1141
|
+
var compliantExecNpcg = /()??/.exec("")[1] === void 0; // NPCG: nonparticipating capturing group
|
1142
|
+
|
1143
|
+
String.prototype.split = function (separator, limit) {
|
1144
|
+
var string = this;
|
1145
|
+
if (separator === void 0 && limit === 0) {
|
1146
|
+
return [];
|
1147
|
+
}
|
1148
|
+
|
1149
|
+
// If `separator` is not a regex, use native split
|
1150
|
+
if (_toString.call(separator) !== "[object RegExp]") {
|
1151
|
+
return string_split.call(this, separator, limit);
|
1152
|
+
}
|
1153
|
+
|
1154
|
+
var output = [],
|
1155
|
+
flags = (separator.ignoreCase ? "i" : "") +
|
1156
|
+
(separator.multiline ? "m" : "") +
|
1157
|
+
(separator.extended ? "x" : "") + // Proposed for ES6
|
1158
|
+
(separator.sticky ? "y" : ""), // Firefox 3+
|
1159
|
+
lastLastIndex = 0,
|
1160
|
+
// Make `global` and avoid `lastIndex` issues by working with a copy
|
1161
|
+
separator2, match, lastIndex, lastLength;
|
1162
|
+
separator = new RegExp(separator.source, flags + "g");
|
1163
|
+
string += ""; // Type-convert
|
1164
|
+
if (!compliantExecNpcg) {
|
1165
|
+
// Doesn't need flags gy, but they don't hurt
|
1166
|
+
separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags);
|
1167
|
+
}
|
1168
|
+
/* Values for `limit`, per the spec:
|
1169
|
+
* If undefined: 4294967295 // Math.pow(2, 32) - 1
|
1170
|
+
* If 0, Infinity, or NaN: 0
|
1171
|
+
* If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;
|
1172
|
+
* If negative number: 4294967296 - Math.floor(Math.abs(limit))
|
1173
|
+
* If other: Type-convert, then use the above rules
|
1174
|
+
*/
|
1175
|
+
limit = limit === void 0 ?
|
1176
|
+
-1 >>> 0 : // Math.pow(2, 32) - 1
|
1177
|
+
ToUint32(limit);
|
1178
|
+
while (match = separator.exec(string)) {
|
1179
|
+
// `separator.lastIndex` is not reliable cross-browser
|
1180
|
+
lastIndex = match.index + match[0].length;
|
1181
|
+
if (lastIndex > lastLastIndex) {
|
1182
|
+
output.push(string.slice(lastLastIndex, match.index));
|
1183
|
+
// Fix browsers whose `exec` methods don't consistently return `undefined` for
|
1184
|
+
// nonparticipating capturing groups
|
1185
|
+
if (!compliantExecNpcg && match.length > 1) {
|
1186
|
+
match[0].replace(separator2, function () {
|
1187
|
+
for (var i = 1; i < arguments.length - 2; i++) {
|
1188
|
+
if (arguments[i] === void 0) {
|
1189
|
+
match[i] = void 0;
|
1190
|
+
}
|
1191
|
+
}
|
1192
|
+
});
|
1193
|
+
}
|
1194
|
+
if (match.length > 1 && match.index < string.length) {
|
1195
|
+
Array.prototype.push.apply(output, match.slice(1));
|
1196
|
+
}
|
1197
|
+
lastLength = match[0].length;
|
1198
|
+
lastLastIndex = lastIndex;
|
1199
|
+
if (output.length >= limit) {
|
1200
|
+
break;
|
1201
|
+
}
|
1202
|
+
}
|
1203
|
+
if (separator.lastIndex === match.index) {
|
1204
|
+
separator.lastIndex++; // Avoid an infinite loop
|
1205
|
+
}
|
1206
|
+
}
|
1207
|
+
if (lastLastIndex === string.length) {
|
1208
|
+
if (lastLength || !separator.test("")) {
|
1209
|
+
output.push("");
|
1210
|
+
}
|
1211
|
+
} else {
|
1212
|
+
output.push(string.slice(lastLastIndex));
|
1213
|
+
}
|
1214
|
+
return output.length > limit ? output.slice(0, limit) : output;
|
1215
|
+
};
|
1216
|
+
}());
|
1185
1217
|
|
1186
1218
|
// [bugfix, chrome]
|
1187
1219
|
// If separator is undefined, then the result array contains just one String,
|
@@ -1189,56 +1221,100 @@ if (
|
|
1189
1221
|
// then the output array is truncated so that it contains no more than limit
|
1190
1222
|
// elements.
|
1191
1223
|
// "0".split(undefined, 0) -> []
|
1192
|
-
} else if ("0".split(void 0, 0).length) {
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
}
|
1224
|
+
} else if ("0".split(void 0, 0).length) {
|
1225
|
+
String.prototype.split = function split(separator, limit) {
|
1226
|
+
if (separator === void 0 && limit === 0) { return []; }
|
1227
|
+
return string_split.call(this, separator, limit);
|
1228
|
+
};
|
1229
|
+
}
|
1198
1230
|
|
1231
|
+
var str_replace = String.prototype.replace;
|
1232
|
+
var replaceReportsGroupsCorrectly = (function () {
|
1233
|
+
var groups = [];
|
1234
|
+
'x'.replace(/x(.)?/g, function (match, group) {
|
1235
|
+
groups.push(group);
|
1236
|
+
});
|
1237
|
+
return groups.length === 1 && typeof groups[0] === 'undefined';
|
1238
|
+
}());
|
1239
|
+
|
1240
|
+
if (!replaceReportsGroupsCorrectly) {
|
1241
|
+
String.prototype.replace = function replace(searchValue, replaceValue) {
|
1242
|
+
var isFn = isFunction(replaceValue);
|
1243
|
+
var hasCapturingGroups = isRegex(searchValue) && (/\)[*?]/).test(searchValue.source);
|
1244
|
+
if (!isFn || !hasCapturingGroups) {
|
1245
|
+
return str_replace.call(this, searchValue, replaceValue);
|
1246
|
+
} else {
|
1247
|
+
var wrappedReplaceValue = function (match) {
|
1248
|
+
var length = arguments.length;
|
1249
|
+
var originalLastIndex = searchValue.lastIndex;
|
1250
|
+
searchValue.lastIndex = 0;
|
1251
|
+
var args = searchValue.exec(match);
|
1252
|
+
searchValue.lastIndex = originalLastIndex;
|
1253
|
+
args.push(arguments[length - 2], arguments[length - 1]);
|
1254
|
+
return replaceValue.apply(this, args);
|
1255
|
+
};
|
1256
|
+
return str_replace.call(this, searchValue, wrappedReplaceValue);
|
1257
|
+
}
|
1258
|
+
};
|
1259
|
+
}
|
1199
1260
|
|
1200
1261
|
// ECMA-262, 3rd B.2.3
|
1201
|
-
//
|
1262
|
+
// Not an ECMAScript standard, although ECMAScript 3rd Edition has a
|
1202
1263
|
// non-normative section suggesting uniform semantics and it should be
|
1203
1264
|
// normalized across all browsers
|
1204
1265
|
// [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IE
|
1205
|
-
if("".substr && "0b".substr(-1) !== "b") {
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
}
|
1266
|
+
if ("".substr && "0b".substr(-1) !== "b") {
|
1267
|
+
var string_substr = String.prototype.substr;
|
1268
|
+
/**
|
1269
|
+
* Get the substring of a string
|
1270
|
+
* @param {integer} start where to start the substring
|
1271
|
+
* @param {integer} length how many characters to return
|
1272
|
+
* @return {string}
|
1273
|
+
*/
|
1274
|
+
String.prototype.substr = function substr(start, length) {
|
1275
|
+
return string_substr.call(
|
1276
|
+
this,
|
1277
|
+
start < 0 ? ((start = this.length + start) < 0 ? 0 : start) : start,
|
1278
|
+
length
|
1279
|
+
);
|
1280
|
+
};
|
1281
|
+
}
|
1221
1282
|
|
1222
1283
|
// ES5 15.5.4.20
|
1223
|
-
// http://es5.github.
|
1224
|
-
var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
}
|
1284
|
+
// whitespace from: http://es5.github.io/#x15.5.4.20
|
1285
|
+
var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
|
1286
|
+
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
|
1287
|
+
"\u2029\uFEFF";
|
1288
|
+
var zeroWidth = '\u200b';
|
1289
|
+
if (!String.prototype.trim || ws.trim() || !zeroWidth.trim()) {
|
1290
|
+
// http://blog.stevenlevithan.com/archives/faster-trim-javascript
|
1291
|
+
// http://perfectionkills.com/whitespace-deviations/
|
1292
|
+
ws = "[" + ws + "]";
|
1293
|
+
var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
|
1294
|
+
trimEndRegexp = new RegExp(ws + ws + "*$");
|
1295
|
+
String.prototype.trim = function trim() {
|
1296
|
+
if (this === void 0 || this === null) {
|
1297
|
+
throw new TypeError("can't convert " + this + " to object");
|
1298
|
+
}
|
1299
|
+
return String(this)
|
1300
|
+
.replace(trimBeginRegexp, "")
|
1301
|
+
.replace(trimEndRegexp, "");
|
1302
|
+
};
|
1303
|
+
}
|
1304
|
+
|
1305
|
+
// ES-5 15.1.2.2
|
1306
|
+
if (parseInt(ws + '08') !== 8 || parseInt(ws + '0x16') !== 22) {
|
1307
|
+
parseInt = (function (origParseInt) {
|
1308
|
+
var hexRegex = /^0[xX]/;
|
1309
|
+
return function parseIntES5(str, radix) {
|
1310
|
+
str = String(str).trim();
|
1311
|
+
if (!Number(radix)) {
|
1312
|
+
radix = hexRegex.test(str) ? 16 : 10;
|
1313
|
+
}
|
1314
|
+
return origParseInt(str, radix);
|
1315
|
+
};
|
1316
|
+
}(parseInt));
|
1317
|
+
}
|
1242
1318
|
|
1243
1319
|
//
|
1244
1320
|
// Util
|
@@ -1249,57 +1325,61 @@ if (!String.prototype.trim || ws.trim()) {
|
|
1249
1325
|
// http://es5.github.com/#x9.4
|
1250
1326
|
// http://jsperf.com/to-integer
|
1251
1327
|
|
1252
|
-
function toInteger(n) {
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
}
|
1328
|
+
function toInteger(n) {
|
1329
|
+
n = +n;
|
1330
|
+
if (n !== n) { // isNaN
|
1331
|
+
n = 0;
|
1332
|
+
} else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) {
|
1333
|
+
n = (n > 0 || -1) * Math.floor(Math.abs(n));
|
1334
|
+
}
|
1335
|
+
return n;
|
1336
|
+
}
|
1261
1337
|
|
1262
|
-
function isPrimitive(input) {
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
}
|
1338
|
+
function isPrimitive(input) {
|
1339
|
+
var type = typeof input;
|
1340
|
+
return (
|
1341
|
+
input === null ||
|
1342
|
+
type === "undefined" ||
|
1343
|
+
type === "boolean" ||
|
1344
|
+
type === "number" ||
|
1345
|
+
type === "string"
|
1346
|
+
);
|
1347
|
+
}
|
1272
1348
|
|
1273
|
-
function toPrimitive(input) {
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
}
|
1349
|
+
function toPrimitive(input) {
|
1350
|
+
var val, valueOf, toStr;
|
1351
|
+
if (isPrimitive(input)) {
|
1352
|
+
return input;
|
1353
|
+
}
|
1354
|
+
valueOf = input.valueOf;
|
1355
|
+
if (isFunction(valueOf)) {
|
1356
|
+
val = valueOf.call(input);
|
1357
|
+
if (isPrimitive(val)) {
|
1358
|
+
return val;
|
1359
|
+
}
|
1360
|
+
}
|
1361
|
+
toStr = input.toString;
|
1362
|
+
if (isFunction(toStr)) {
|
1363
|
+
val = toStr.call(input);
|
1364
|
+
if (isPrimitive(val)) {
|
1365
|
+
return val;
|
1366
|
+
}
|
1367
|
+
}
|
1368
|
+
throw new TypeError();
|
1369
|
+
}
|
1294
1370
|
|
1295
1371
|
// ES5 9.9
|
1296
1372
|
// http://es5.github.com/#x9.9
|
1297
|
-
var toObject = function (o) {
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
};
|
1373
|
+
var toObject = function (o) {
|
1374
|
+
if (o == null) { // this matches both null and undefined
|
1375
|
+
throw new TypeError("can't convert " + o + " to object");
|
1376
|
+
}
|
1377
|
+
return Object(o);
|
1378
|
+
};
|
1379
|
+
|
1380
|
+
var ToUint32 = function ToUint32(x) {
|
1381
|
+
return x >>> 0;
|
1382
|
+
};
|
1303
1383
|
|
1304
1384
|
})();
|
1305
1385
|
|