diff --git a/dist/fineui.js b/dist/fineui.js index 95b456d4a..c2a468b3d 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -154,7 +154,49 @@ window.localStorage || (window.localStorage = { clear: function () { this.items = {}; } -});if (typeof Set !== "undefined" && Set.toString().match(/native code/)) { +}); +if (!Object.keys) { + Object.keys = function(o) { + if (o !== Object(o)) { + throw new TypeError('Object.keys called on a non-object'); + } + // fix的问题 + var falsy; + var skipArray = { + __ob__: falsy, + $accessors: falsy, + $vbthis: falsy, + $vbsetter: falsy + }; + var k = [], p; + for (p in o) { + if (!(p in skipArray)) { + if (Object.prototype.hasOwnProperty.call(o, p)) { + k.push(p); + } + } + } + return k; + }; +} + +if (!Array.isArray) { + Array.isArray = function(arg) { + return Object.prototype.toString.call(arg) === '[object Array]'; + }; +} + +// https://stackoverflow.com/questions/10919915/ie8-getprototypeof-method +if (typeof Object.getPrototypeOf !== "function") { + Object.getPrototypeOf = "".__proto__ === String.prototype + ? function (object) { + return object.__proto__; + } + : function (object) { + // May break if the constructor has been tampered with + return object.constructor.prototype; + }; +}if (typeof Set !== "undefined" && Set.toString().match(/native code/)) { } else { Set = function () { diff --git a/dist/polyfill.js b/dist/polyfill.js index 052cfb574..47f771c9d 100644 --- a/dist/polyfill.js +++ b/dist/polyfill.js @@ -154,7 +154,49 @@ window.localStorage || (window.localStorage = { clear: function () { this.items = {}; } -});if (typeof Set !== "undefined" && Set.toString().match(/native code/)) { +}); +if (!Object.keys) { + Object.keys = function(o) { + if (o !== Object(o)) { + throw new TypeError('Object.keys called on a non-object'); + } + // fix的问题 + var falsy; + var skipArray = { + __ob__: falsy, + $accessors: falsy, + $vbthis: falsy, + $vbsetter: falsy + }; + var k = [], p; + for (p in o) { + if (!(p in skipArray)) { + if (Object.prototype.hasOwnProperty.call(o, p)) { + k.push(p); + } + } + } + return k; + }; +} + +if (!Array.isArray) { + Array.isArray = function(arg) { + return Object.prototype.toString.call(arg) === '[object Array]'; + }; +} + +// https://stackoverflow.com/questions/10919915/ie8-getprototypeof-method +if (typeof Object.getPrototypeOf !== "function") { + Object.getPrototypeOf = "".__proto__ === String.prototype + ? function (object) { + return object.__proto__; + } + : function (object) { + // May break if the constructor has been tampered with + return object.constructor.prototype; + }; +}if (typeof Set !== "undefined" && Set.toString().match(/native code/)) { } else { Set = function () { diff --git a/src/polyfill/lodash.js b/src/polyfill/lodash.js new file mode 100644 index 000000000..e01c30f80 --- /dev/null +++ b/src/polyfill/lodash.js @@ -0,0 +1,43 @@ + +if (!Object.keys) { + Object.keys = function(o) { + if (o !== Object(o)) { + throw new TypeError('Object.keys called on a non-object'); + } + // fix的问题 + var falsy; + var skipArray = { + __ob__: falsy, + $accessors: falsy, + $vbthis: falsy, + $vbsetter: falsy + }; + var k = [], p; + for (p in o) { + if (!(p in skipArray)) { + if (Object.prototype.hasOwnProperty.call(o, p)) { + k.push(p); + } + } + } + return k; + }; +} + +if (!Array.isArray) { + Array.isArray = function(arg) { + return Object.prototype.toString.call(arg) === '[object Array]'; + }; +} + +// https://stackoverflow.com/questions/10919915/ie8-getprototypeof-method +if (typeof Object.getPrototypeOf !== "function") { + Object.getPrototypeOf = "".__proto__ === String.prototype + ? function (object) { + return object.__proto__; + } + : function (object) { + // May break if the constructor has been tampered with + return object.constructor.prototype; + }; +} \ No newline at end of file