Lots of updates
This commit is contained in:
parent
e3cfff8310
commit
39e7af6238
454 changed files with 221168 additions and 36622 deletions
239
app/bower_components/es5-shim/es5-sham.js
vendored
239
app/bower_components/es5-shim/es5-sham.js
vendored
|
@ -1,17 +1,20 @@
|
|||
/*!
|
||||
* https://github.com/es-shims/es5-shim
|
||||
* @license es5-shim Copyright 2009-2014 by contributors, MIT License
|
||||
* @license es5-shim Copyright 2009-2015 by contributors, MIT License
|
||||
* see https://github.com/es-shims/es5-shim/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
// vim: ts=4 sts=4 sw=4 expandtab
|
||||
|
||||
//Add semicolon to prevent IIFE from being passed as argument to concated code.
|
||||
// Add semicolon to prevent IIFE from being passed as argument to concatenated code.
|
||||
;
|
||||
|
||||
// UMD (Universal Module Definition)
|
||||
// see https://github.com/umdjs/umd/blob/master/returnExports.js
|
||||
// see https://github.com/umdjs/umd/blob/master/templates/returnExports.js
|
||||
(function (root, factory) {
|
||||
'use strict';
|
||||
|
||||
/* global define, exports, module */
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(factory);
|
||||
|
@ -26,21 +29,25 @@
|
|||
}
|
||||
}(this, function () {
|
||||
|
||||
var call = Function.prototype.call;
|
||||
var call = Function.call;
|
||||
var prototypeOfObject = Object.prototype;
|
||||
var owns = call.bind(prototypeOfObject.hasOwnProperty);
|
||||
var isEnumerable = call.bind(prototypeOfObject.propertyIsEnumerable);
|
||||
var toStr = call.bind(prototypeOfObject.toString);
|
||||
|
||||
// If JS engine supports accessors creating shortcuts.
|
||||
var defineGetter;
|
||||
var defineSetter;
|
||||
var lookupGetter;
|
||||
var lookupSetter;
|
||||
var supportsAccessors = owns(prototypeOfObject, "__defineGetter__");
|
||||
var supportsAccessors = owns(prototypeOfObject, '__defineGetter__');
|
||||
if (supportsAccessors) {
|
||||
/* eslint-disable no-underscore-dangle */
|
||||
defineGetter = call.bind(prototypeOfObject.__defineGetter__);
|
||||
defineSetter = call.bind(prototypeOfObject.__defineSetter__);
|
||||
lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
|
||||
lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
|
||||
/* eslint-enable no-underscore-dangle */
|
||||
}
|
||||
|
||||
// ES5 15.2.3.2
|
||||
|
@ -54,48 +61,53 @@ if (!Object.getPrototypeOf) {
|
|||
// ... this will nerever possibly return null
|
||||
// ... Opera Mini breaks here with infinite loops
|
||||
Object.getPrototypeOf = function getPrototypeOf(object) {
|
||||
/* eslint-disable no-proto */
|
||||
var proto = object.__proto__;
|
||||
/* eslint-enable no-proto */
|
||||
if (proto || proto === null) {
|
||||
return proto;
|
||||
} else if (object.constructor) {
|
||||
} else if (toStr(object.constructor) === '[object Function]') {
|
||||
return object.constructor.prototype;
|
||||
} else if (object instanceof Object) {
|
||||
return prototypeOfObject;
|
||||
} else {
|
||||
return prototypeOfObject;
|
||||
// Correctly return null for Objects created with `Object.create(null)`
|
||||
// (shammed or native) or `{ __proto__: null}`. Also returns null for
|
||||
// cross-realm objects on browsers that lack `__proto__` support (like
|
||||
// IE <11), but that's the best we can do.
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//ES5 15.2.3.3
|
||||
//http://es5.github.com/#x15.2.3.3
|
||||
// ES5 15.2.3.3
|
||||
// http://es5.github.com/#x15.2.3.3
|
||||
|
||||
function doesGetOwnPropertyDescriptorWork(object) {
|
||||
var doesGetOwnPropertyDescriptorWork = function doesGetOwnPropertyDescriptorWork(object) {
|
||||
try {
|
||||
object.sentinel = 0;
|
||||
return Object.getOwnPropertyDescriptor(
|
||||
object,
|
||||
"sentinel"
|
||||
).value === 0;
|
||||
return Object.getOwnPropertyDescriptor(object, 'sentinel').value === 0;
|
||||
} catch (exception) {
|
||||
// returns falsy
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//check whether getOwnPropertyDescriptor works if it's given. Otherwise,
|
||||
//shim partially.
|
||||
// check whether getOwnPropertyDescriptor works if it's given. Otherwise, shim partially.
|
||||
if (Object.defineProperty) {
|
||||
var getOwnPropertyDescriptorWorksOnObject = doesGetOwnPropertyDescriptorWork({});
|
||||
var getOwnPropertyDescriptorWorksOnDom = typeof document === "undefined" ||
|
||||
doesGetOwnPropertyDescriptorWork(document.createElement("div"));
|
||||
var getOwnPropertyDescriptorWorksOnDom = typeof document === 'undefined' ||
|
||||
doesGetOwnPropertyDescriptorWork(document.createElement('div'));
|
||||
if (!getOwnPropertyDescriptorWorksOnDom || !getOwnPropertyDescriptorWorksOnObject) {
|
||||
var getOwnPropertyDescriptorFallback = Object.getOwnPropertyDescriptor;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Object.getOwnPropertyDescriptor || getOwnPropertyDescriptorFallback) {
|
||||
var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a non-object: ";
|
||||
var ERR_NON_OBJECT = 'Object.getOwnPropertyDescriptor called on a non-object: ';
|
||||
|
||||
/* eslint-disable no-proto */
|
||||
Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
|
||||
if ((typeof object !== "object" && typeof object !== "function") || object === null) {
|
||||
if ((typeof object !== 'object' && typeof object !== 'function') || object === null) {
|
||||
throw new TypeError(ERR_NON_OBJECT + object);
|
||||
}
|
||||
|
||||
|
@ -109,14 +121,19 @@ if (!Object.getOwnPropertyDescriptor || getOwnPropertyDescriptorFallback) {
|
|||
}
|
||||
}
|
||||
|
||||
var descriptor;
|
||||
|
||||
// If object does not owns property return undefined immediately.
|
||||
if (!owns(object, property)) {
|
||||
return;
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
// If object has a property then it's for sure both `enumerable` and
|
||||
// `configurable`.
|
||||
var descriptor = { enumerable: true, configurable: true };
|
||||
// If object has a property then it's for sure `configurable`, and
|
||||
// probably `enumerable`. Detect enumerability though.
|
||||
descriptor = {
|
||||
enumerable: isEnumerable(object, property),
|
||||
configurable: true
|
||||
};
|
||||
|
||||
// If JS engine supports accessor properties then property may be a
|
||||
// getter or setter.
|
||||
|
@ -162,6 +179,7 @@ if (!Object.getOwnPropertyDescriptor || getOwnPropertyDescriptorFallback) {
|
|||
descriptor.writable = true;
|
||||
return descriptor;
|
||||
};
|
||||
/* eslint-enable no-proto */
|
||||
}
|
||||
|
||||
// ES5 15.2.3.4
|
||||
|
@ -178,13 +196,73 @@ if (!Object.create) {
|
|||
|
||||
// Contributed by Brandon Benvie, October, 2012
|
||||
var createEmpty;
|
||||
var supportsProto = !({__proto__:null} instanceof Object);
|
||||
var supportsProto = !({ __proto__: null } instanceof Object);
|
||||
// the following produces false positives
|
||||
// in Opera Mini => not a reliable check
|
||||
// Object.prototype.__proto__ === null
|
||||
|
||||
// Check for document.domain and active x support
|
||||
// No need to use active x approach when document.domain is not set
|
||||
// see https://github.com/es-shims/es5-shim/issues/150
|
||||
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
|
||||
/* global ActiveXObject */
|
||||
var shouldUseActiveX = function shouldUseActiveX() {
|
||||
// return early if document.domain not set
|
||||
if (!document.domain) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
return !!new ActiveXObject('htmlfile');
|
||||
} catch (exception) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// This supports IE8 when document.domain is used
|
||||
// see https://github.com/es-shims/es5-shim/issues/150
|
||||
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
|
||||
var getEmptyViaActiveX = function getEmptyViaActiveX() {
|
||||
var empty;
|
||||
var xDoc;
|
||||
|
||||
xDoc = new ActiveXObject('htmlfile');
|
||||
|
||||
var script = 'script';
|
||||
xDoc.write('<' + script + '></' + script + '>');
|
||||
xDoc.close();
|
||||
|
||||
empty = xDoc.parentWindow.Object.prototype;
|
||||
xDoc = null;
|
||||
|
||||
return empty;
|
||||
};
|
||||
|
||||
// The original implementation using an iframe
|
||||
// before the activex approach was added
|
||||
// see https://github.com/es-shims/es5-shim/issues/150
|
||||
var getEmptyViaIFrame = function getEmptyViaIFrame() {
|
||||
var iframe = document.createElement('iframe');
|
||||
var parent = document.body || document.documentElement;
|
||||
var empty;
|
||||
|
||||
iframe.style.display = 'none';
|
||||
parent.appendChild(iframe);
|
||||
/* eslint-disable no-script-url */
|
||||
iframe.src = 'javascript:';
|
||||
/* eslint-enable no-script-url */
|
||||
|
||||
empty = iframe.contentWindow.Object.prototype;
|
||||
parent.removeChild(iframe);
|
||||
iframe = null;
|
||||
|
||||
return empty;
|
||||
};
|
||||
|
||||
/* global document */
|
||||
if (supportsProto || typeof document === 'undefined') {
|
||||
createEmpty = function () {
|
||||
return { "__proto__": null };
|
||||
return { __proto__: null };
|
||||
};
|
||||
} else {
|
||||
// In old IE __proto__ can't be used to manually set `null`, nor does
|
||||
|
@ -193,14 +271,10 @@ if (!Object.create) {
|
|||
// object and *steal* its Object.prototype and strip it bare. This is
|
||||
// used as the prototype to create nullary objects.
|
||||
createEmpty = function () {
|
||||
var iframe = document.createElement('iframe');
|
||||
var parent = document.body || document.documentElement;
|
||||
iframe.style.display = 'none';
|
||||
parent.appendChild(iframe);
|
||||
iframe.src = 'javascript:';
|
||||
var empty = iframe.contentWindow.Object.prototype;
|
||||
parent.removeChild(iframe);
|
||||
iframe = null;
|
||||
// Determine which approach to use
|
||||
// see https://github.com/es-shims/es5-shim/issues/150
|
||||
var empty = shouldUseActiveX() ? getEmptyViaActiveX() : getEmptyViaIFrame();
|
||||
|
||||
delete empty.constructor;
|
||||
delete empty.hasOwnProperty;
|
||||
delete empty.propertyIsEnumerable;
|
||||
|
@ -208,9 +282,8 @@ if (!Object.create) {
|
|||
delete empty.toLocaleString;
|
||||
delete empty.toString;
|
||||
delete empty.valueOf;
|
||||
empty.__proto__ = null;
|
||||
|
||||
function Empty() {}
|
||||
var Empty = function Empty() {};
|
||||
Empty.prototype = empty;
|
||||
// short-circuit future calls
|
||||
createEmpty = function () {
|
||||
|
@ -223,18 +296,18 @@ if (!Object.create) {
|
|||
Object.create = function create(prototype, properties) {
|
||||
|
||||
var object;
|
||||
function Type() {} // An empty constructor.
|
||||
var Type = function Type() {}; // An empty constructor.
|
||||
|
||||
if (prototype === null) {
|
||||
object = createEmpty();
|
||||
} else {
|
||||
if (typeof prototype !== "object" && typeof prototype !== "function") {
|
||||
if (typeof prototype !== 'object' && typeof prototype !== 'function') {
|
||||
// In the native implementation `parent` can be `null`
|
||||
// OR *any* `instanceof Object` (Object|Function|Array|RegExp|etc)
|
||||
// Use `typeof` tho, b/c in old IE, DOM elements are not `instanceof Object`
|
||||
// like they are in modern browsers. Using `Object.create` on DOM elements
|
||||
// is...err...probably inappropriate, but the native version allows for it.
|
||||
throw new TypeError("Object prototype may only be an Object or null"); // same msg as Chrome
|
||||
throw new TypeError('Object prototype may only be an Object or null'); // same msg as Chrome
|
||||
}
|
||||
Type.prototype = prototype;
|
||||
object = new Type();
|
||||
|
@ -242,7 +315,9 @@ if (!Object.create) {
|
|||
// neither `__proto__`, but this manually setting `__proto__` will
|
||||
// guarantee that `Object.getPrototypeOf` will work as expected with
|
||||
// objects created using `Object.create`
|
||||
/* eslint-disable no-proto */
|
||||
object.__proto__ = prototype;
|
||||
/* eslint-enable no-proto */
|
||||
}
|
||||
|
||||
if (properties !== void 0) {
|
||||
|
@ -265,21 +340,21 @@ if (!Object.create) {
|
|||
// WebKit Bugs:
|
||||
// https://bugs.webkit.org/show_bug.cgi?id=36423
|
||||
|
||||
function doesDefinePropertyWork(object) {
|
||||
var doesDefinePropertyWork = function doesDefinePropertyWork(object) {
|
||||
try {
|
||||
Object.defineProperty(object, "sentinel", {});
|
||||
return "sentinel" in object;
|
||||
Object.defineProperty(object, 'sentinel', {});
|
||||
return 'sentinel' in object;
|
||||
} catch (exception) {
|
||||
// returns falsy
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// check whether defineProperty works if it's given. Otherwise,
|
||||
// shim partially.
|
||||
if (Object.defineProperty) {
|
||||
var definePropertyWorksOnObject = doesDefinePropertyWork({});
|
||||
var definePropertyWorksOnDom = typeof document === "undefined" ||
|
||||
doesDefinePropertyWork(document.createElement("div"));
|
||||
var definePropertyWorksOnDom = typeof document === 'undefined' ||
|
||||
doesDefinePropertyWork(document.createElement('div'));
|
||||
if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
|
||||
var definePropertyFallback = Object.defineProperty,
|
||||
definePropertiesFallback = Object.defineProperties;
|
||||
|
@ -287,16 +362,15 @@ if (Object.defineProperty) {
|
|||
}
|
||||
|
||||
if (!Object.defineProperty || definePropertyFallback) {
|
||||
var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
|
||||
var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
|
||||
var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
|
||||
"on this javascript engine";
|
||||
var ERR_NON_OBJECT_DESCRIPTOR = 'Property description must be an object: ';
|
||||
var ERR_NON_OBJECT_TARGET = 'Object.defineProperty called on non-object: ';
|
||||
var ERR_ACCESSORS_NOT_SUPPORTED = 'getters & setters can not be defined on this javascript engine';
|
||||
|
||||
Object.defineProperty = function defineProperty(object, property, descriptor) {
|
||||
if ((typeof object !== "object" && typeof object !== "function") || object === null) {
|
||||
if ((typeof object !== 'object' && typeof object !== 'function') || object === null) {
|
||||
throw new TypeError(ERR_NON_OBJECT_TARGET + object);
|
||||
}
|
||||
if ((typeof descriptor !== "object" && typeof descriptor !== "function") || descriptor === null) {
|
||||
if ((typeof descriptor !== 'object' && typeof descriptor !== 'function') || descriptor === null) {
|
||||
throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
|
||||
}
|
||||
// make a valiant attempt to use the real defineProperty
|
||||
|
@ -310,29 +384,27 @@ if (!Object.defineProperty || definePropertyFallback) {
|
|||
}
|
||||
|
||||
// If it's a data property.
|
||||
if (owns(descriptor, "value")) {
|
||||
// fail silently if "writable", "enumerable", or "configurable"
|
||||
if ('value' in descriptor) {
|
||||
// fail silently if 'writable', 'enumerable', or 'configurable'
|
||||
// are requested but not supported
|
||||
/*
|
||||
// alternate approach:
|
||||
if ( // can't implement these features; allow false but not true
|
||||
!(owns(descriptor, "writable") ? descriptor.writable : true) ||
|
||||
!(owns(descriptor, "enumerable") ? descriptor.enumerable : true) ||
|
||||
!(owns(descriptor, "configurable") ? descriptor.configurable : true)
|
||||
)
|
||||
('writable' in descriptor && !descriptor.writable) ||
|
||||
('enumerable' in descriptor && !descriptor.enumerable) ||
|
||||
('configurable' in descriptor && !descriptor.configurable)
|
||||
))
|
||||
throw new RangeError(
|
||||
"This implementation of Object.defineProperty does not " +
|
||||
"support configurable, enumerable, or writable."
|
||||
'This implementation of Object.defineProperty does not support configurable, enumerable, or writable.'
|
||||
);
|
||||
*/
|
||||
|
||||
if (supportsAccessors && (lookupGetter(object, property) ||
|
||||
lookupSetter(object, property)))
|
||||
{
|
||||
if (supportsAccessors && (lookupGetter(object, property) || lookupSetter(object, property))) {
|
||||
// As accessors are supported only on engines implementing
|
||||
// `__proto__` we can safely override `__proto__` while defining
|
||||
// a property to make sure that we don't hit an inherited
|
||||
// accessor.
|
||||
/* eslint-disable no-proto */
|
||||
var prototype = object.__proto__;
|
||||
object.__proto__ = prototypeOfObject;
|
||||
// Deleting a property anyway since getter / setter may be
|
||||
|
@ -341,18 +413,19 @@ if (!Object.defineProperty || definePropertyFallback) {
|
|||
object[property] = descriptor.value;
|
||||
// Setting original `__proto__` back now.
|
||||
object.__proto__ = prototype;
|
||||
/* eslint-enable no-proto */
|
||||
} else {
|
||||
object[property] = descriptor.value;
|
||||
}
|
||||
} else {
|
||||
if (!supportsAccessors) {
|
||||
if (!supportsAccessors && (('get' in descriptor) || ('set' in descriptor))) {
|
||||
throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
|
||||
}
|
||||
// If we got that far then getters and setters can be defined !!
|
||||
if (owns(descriptor, "get")) {
|
||||
if ('get' in descriptor) {
|
||||
defineGetter(object, property, descriptor.get);
|
||||
}
|
||||
if (owns(descriptor, "set")) {
|
||||
if ('set' in descriptor) {
|
||||
defineSetter(object, property, descriptor.set);
|
||||
}
|
||||
}
|
||||
|
@ -373,11 +446,11 @@ if (!Object.defineProperties || definePropertiesFallback) {
|
|||
}
|
||||
}
|
||||
|
||||
for (var property in properties) {
|
||||
if (owns(properties, property) && property !== "__proto__") {
|
||||
Object.keys(properties).forEach(function (property) {
|
||||
if (property !== '__proto__') {
|
||||
Object.defineProperty(object, property, properties[property]);
|
||||
}
|
||||
}
|
||||
});
|
||||
return object;
|
||||
};
|
||||
}
|
||||
|
@ -386,6 +459,9 @@ if (!Object.defineProperties || definePropertiesFallback) {
|
|||
// http://es5.github.com/#x15.2.3.8
|
||||
if (!Object.seal) {
|
||||
Object.seal = function seal(object) {
|
||||
if (Object(object) !== object) {
|
||||
throw new TypeError('Object.seal can only be called on Objects.');
|
||||
}
|
||||
// this is misleading and breaks feature-detection, but
|
||||
// allows "securable" code to "gracefully" degrade to working
|
||||
// but insecure code.
|
||||
|
@ -397,6 +473,9 @@ if (!Object.seal) {
|
|||
// http://es5.github.com/#x15.2.3.9
|
||||
if (!Object.freeze) {
|
||||
Object.freeze = function freeze(object) {
|
||||
if (Object(object) !== object) {
|
||||
throw new TypeError('Object.freeze can only be called on Objects.');
|
||||
}
|
||||
// this is misleading and breaks feature-detection, but
|
||||
// allows "securable" code to "gracefully" degrade to working
|
||||
// but insecure code.
|
||||
|
@ -408,21 +487,24 @@ if (!Object.freeze) {
|
|||
try {
|
||||
Object.freeze(function () {});
|
||||
} catch (exception) {
|
||||
Object.freeze = (function freeze(freezeObject) {
|
||||
Object.freeze = (function (freezeObject) {
|
||||
return function freeze(object) {
|
||||
if (typeof object === "function") {
|
||||
if (typeof object === 'function') {
|
||||
return object;
|
||||
} else {
|
||||
return freezeObject(object);
|
||||
}
|
||||
};
|
||||
})(Object.freeze);
|
||||
}(Object.freeze));
|
||||
}
|
||||
|
||||
// ES5 15.2.3.10
|
||||
// http://es5.github.com/#x15.2.3.10
|
||||
if (!Object.preventExtensions) {
|
||||
Object.preventExtensions = function preventExtensions(object) {
|
||||
if (Object(object) !== object) {
|
||||
throw new TypeError('Object.preventExtensions can only be called on Objects.');
|
||||
}
|
||||
// this is misleading and breaks feature-detection, but
|
||||
// allows "securable" code to "gracefully" degrade to working
|
||||
// but insecure code.
|
||||
|
@ -434,6 +516,9 @@ if (!Object.preventExtensions) {
|
|||
// http://es5.github.com/#x15.2.3.11
|
||||
if (!Object.isSealed) {
|
||||
Object.isSealed = function isSealed(object) {
|
||||
if (Object(object) !== object) {
|
||||
throw new TypeError('Object.isSealed can only be called on Objects.');
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
@ -442,6 +527,9 @@ if (!Object.isSealed) {
|
|||
// http://es5.github.com/#x15.2.3.12
|
||||
if (!Object.isFrozen) {
|
||||
Object.isFrozen = function isFrozen(object) {
|
||||
if (Object(object) !== object) {
|
||||
throw new TypeError('Object.isFrozen can only be called on Objects.');
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
@ -452,7 +540,7 @@ if (!Object.isExtensible) {
|
|||
Object.isExtensible = function isExtensible(object) {
|
||||
// 1. If Type(O) is not Object throw a TypeError exception.
|
||||
if (Object(object) !== object) {
|
||||
throw new TypeError(); // TODO message
|
||||
throw new TypeError('Object.isExtensible can only be called on Objects.');
|
||||
}
|
||||
// 2. Return the Boolean value of the [[Extensible]] internal property of O.
|
||||
var name = '';
|
||||
|
@ -467,4 +555,3 @@ if (!Object.isExtensible) {
|
|||
}
|
||||
|
||||
}));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue