mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Update Bootstrap.js to provide Array.isArray() if missing.
This commit is contained in:
parent
9a9005a604
commit
d82eb4534c
1 changed files with 11 additions and 5 deletions
|
@ -52,7 +52,7 @@ new function() {
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function inject(dest, src, enumerable, base, generics) {
|
function inject(dest, src, enumerable, base, preserve, generics) {
|
||||||
var beans;
|
var beans;
|
||||||
|
|
||||||
function field(name, val, dontCheck, generics) {
|
function field(name, val, dontCheck, generics) {
|
||||||
|
@ -60,11 +60,11 @@ new function() {
|
||||||
val = (val = describe(src, name)) && (val.get ? val : val.value);
|
val = (val = describe(src, name)) && (val.get ? val : val.value);
|
||||||
var type = typeof val, func = type == 'function', res = val,
|
var type = typeof val, func = type == 'function', res = val,
|
||||||
prev = dest[name], bean, part;
|
prev = dest[name], bean, part;
|
||||||
if (generics && func && (!src.preserve || !generics[name])) generics[name] = function(bind) {
|
if (generics && func && (!preserve || !generics[name])) generics[name] = function(bind) {
|
||||||
return bind && dest[name].apply(bind,
|
return bind && dest[name].apply(bind,
|
||||||
Array.prototype.slice.call(arguments, 1));
|
Array.prototype.slice.call(arguments, 1));
|
||||||
}
|
}
|
||||||
if ((dontCheck || val !== undefined && has(src, name)) && (!prev || !src.preserve)) {
|
if ((dontCheck || val !== undefined && has(src, name)) && (!prev || !preserve)) {
|
||||||
if (func) {
|
if (func) {
|
||||||
if (prev && /\bthis\.base\b/.test(val)) {
|
if (prev && /\bthis\.base\b/.test(val)) {
|
||||||
var fromBase = base && base[name] == prev;
|
var fromBase = base && base[name] == prev;
|
||||||
|
@ -122,8 +122,8 @@ new function() {
|
||||||
inject: function(src) {
|
inject: function(src) {
|
||||||
if (src) {
|
if (src) {
|
||||||
var proto = this.prototype, base = proto.__proto__ && proto.__proto__.constructor;
|
var proto = this.prototype, base = proto.__proto__ && proto.__proto__.constructor;
|
||||||
inject(proto, src, false, base && base.prototype, src.generics && this);
|
inject(proto, src, false, base && base.prototype, src.preserve, src.generics && this);
|
||||||
inject(this, src.statics, true, base);
|
inject(this, src.statics, true, base, src.preserve);
|
||||||
}
|
}
|
||||||
for (var i = 1, l = arguments.length; i < l; i++)
|
for (var i = 1, l = arguments.length; i < l; i++)
|
||||||
this.inject(arguments[i]);
|
this.inject(arguments[i]);
|
||||||
|
@ -482,6 +482,12 @@ Array.inject({
|
||||||
for (var l = this.length; i < l; i++)
|
for (var l = this.length; i < l; i++)
|
||||||
value = fn.call(null, value, this[i], i, this);
|
value = fn.call(null, value, this[i], i, this);
|
||||||
return value;
|
return value;
|
||||||
|
},
|
||||||
|
|
||||||
|
statics: {
|
||||||
|
isArray: function(obj) {
|
||||||
|
return Object.prototype.toString.call(obj) === '[object Array]';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, Enumerable, {
|
}, Enumerable, {
|
||||||
generics: true,
|
generics: true,
|
||||||
|
|
Loading…
Reference in a new issue