forked from es-shims/es5-shim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
es5-sham.min.js
7 lines (7 loc) · 3.37 KB
/
es5-sham.min.js
1
2
3
4
5
6
7
(function(f){"function"==typeof define?define(f):"function"==typeof YUI?YUI.add("es5-sham",f):f()})(function(){function f(a){try{return Object.defineProperty(a,"sentinel",{}),"sentinel"in a}catch(b){}}Object.getPrototypeOf||(Object.getPrototypeOf=function(a){return a.__proto__||(a.constructor?a.constructor.prototype:prototypeOfObject)});Object.getOwnPropertyDescriptor||(Object.getOwnPropertyDescriptor=function(a,b){if(typeof a!="object"&&typeof a!="function"||a===null)throw new TypeError("Object.getOwnPropertyDescriptor called on a non-object: "+
a);if(owns(a,b)){var d={enumerable:true,configurable:true};if(supportsAccessors){var l=a.__proto__;a.__proto__=prototypeOfObject;var c=lookupGetter(a,b),e=lookupSetter(a,b);a.__proto__=l;if(c||e){if(c)d.get=c;if(e)d.set=e;return d}}d.value=a[b];return d}});Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(a){return Object.keys(a)});if(!Object.create){var h;if(null===Object.prototype.__proto__||"undefined"==typeof document)h=function(){return{__proto__:null}};else{var k=function(){},
e=document.createElement("iframe"),g=document.body||document.documentElement;e.style.display="none";g.appendChild(e);e.src="javascript:";var c=e.contentWindow.Object.prototype;g.removeChild(e);e=null;delete c.constructor;delete c.hasOwnProperty;delete c.propertyIsEnumerable;delete c.isPrototypeOf;delete c.toLocaleString;delete c.toString;delete c.valueOf;c.__proto__=null;k.prototype=c;h=function(){return new k}}Object.create=function(a,b){function d(){}var c;if(a===null)c=h();else{if(typeof a!=="object"&&
typeof a!=="function")throw new TypeError("Object prototype may only be an Object or null");d.prototype=a;c=new d;c.__proto__=a}b!==void 0&&Object.defineProperties(c,b);return c}}if(Object.defineProperty&&(e=f({}),g="undefined"==typeof document||f(document.createElement("div")),!e||!g))var i=Object.defineProperty,j=Object.defineProperties;if(!Object.defineProperty||i)Object.defineProperty=function(a,b,d){if(typeof a!="object"&&typeof a!="function"||a===null)throw new TypeError("Object.defineProperty called on non-object: "+
a);if(typeof d!="object"&&typeof d!="function"||d===null)throw new TypeError("Property description must be an object: "+d);if(i)try{return i.call(Object,a,b,d)}catch(c){}if(owns(d,"value"))if(supportsAccessors&&(lookupGetter(a,b)||lookupSetter(a,b))){var e=a.__proto__;a.__proto__=prototypeOfObject;delete a[b];a[b]=d.value;a.__proto__=e}else a[b]=d.value;else{if(!supportsAccessors)throw new TypeError("getters & setters can not be defined on this javascript engine");owns(d,"get")&&defineGetter(a,b,
d.get);owns(d,"set")&&defineSetter(a,b,d.set)}return a};if(!Object.defineProperties||j)Object.defineProperties=function(a,b){if(j)try{return j.call(Object,a,b)}catch(d){}for(var c in b)owns(b,c)&&c!="__proto__"&&Object.defineProperty(a,c,b[c]);return a};Object.seal||(Object.seal=function(a){return a});Object.freeze||(Object.freeze=function(a){return a});try{Object.freeze(function(){})}catch(n){var m=Object.freeze;Object.freeze=function(a){return typeof a=="function"?a:m(a)}}Object.preventExtensions||
(Object.preventExtensions=function(a){return a});Object.isSealed||(Object.isSealed=function(){return false});Object.isFrozen||(Object.isFrozen=function(){return false});Object.isExtensible||(Object.isExtensible=function(a){if(Object(a)!==a)throw new TypeError;for(var b="";owns(a,b);)b=b+"?";a[b]=true;var c=owns(a,b);delete a[b];return c})});