Last active
December 14, 2015 06:18
-
-
Save mturnwall/5041014 to your computer and use it in GitHub Desktop.
Object.create() polyfill since IE8 doesn't support the create() method.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Polyfill for Object.create() | |
* use this to create new objects | |
*/ | |
if (!Object.create) { | |
Object.create = function (o) { | |
if (arguments.length > 1) { | |
throw new Error('Sorry the polyfill Object.create only accepts the first parameter.'); | |
} | |
function F() {} | |
F.prototype = o; | |
return new F(); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment