Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Object.create polyfill to accept any Object instance #118

Closed
wants to merge 1 commit into from
Closed

Fix Object.create polyfill to accept any Object instance #118

wants to merge 1 commit into from

Conversation

ryanve
Copy link

@ryanve ryanve commented Jul 4, 2012

The native Object.create accepts instanceof Object and null. For example, Object.create(jQuery) is totally legit. This pull fixes the polyfill to that effect. The previous typechecking insufficiently used only typeof "object". Use typeof "object"|"function" rather than instanceof Object tho for tighter effective compatibility with the native version. See comments inline.

…t/Reference/Global_Objects/Object/create/) accepts `instanceof Object` and `null`. For example, `Object.create(jQuery)` is totally legit. This pull fixes the polyfill to that effect. The previous typechecking insufficiently used only [typeof](https://developer.mozilla.org/en/JavaScript/Reference/Operators/typeof) `"object". Use [typeof](https://developer.mozilla.org/en/JavaScript/Reference/Operators/typeof) `"object"`|`"function"` rather than `instanceof Object` tho for tighter compatibility with the native version. See comments inline.
@kriskowal kriskowal closed this in bcb2e41 Oct 8, 2012
@ryanve
Copy link
Author

ryanve commented Oct 9, 2012

Great! =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants