Update hasProp to handle object not derived from Object#37
Open
moo3 wants to merge 2 commits intocujojs:masterfrom
Open
Update hasProp to handle object not derived from Object#37moo3 wants to merge 2 commits intocujojs:masterfrom
moo3 wants to merge 2 commits intocujojs:masterfrom
Conversation
object.js
Outdated
Member
There was a problem hiding this comment.
This is a bit confusing, imho. The way this is written, it appears that there is a method, hasOwnProperty defined on the Object constructor. However, hasOwnProperty is only defined on Function.prototype, not on Object. Perhaps you could use the refProto variable from above?
return refProto.hasOwnProperty.call(object, name);
Author
|
Agreed. I overlooked the refProto, shall update now. |
Replaced direct reference to Object and replaced with refProto variable, which refers to Object.prototype.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is change was needed in our project since we had custom objects that inherits null and not Object. In this case it fails in IE8 since the hasProp method assumes the first param object to inherit Object which is not the case always.