-
Notifications
You must be signed in to change notification settings - Fork 50.4k
added hasOwnProperty checks for object iteration #1385
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
Conversation
|
(first pull request: completed CLA) |
src/browser/ui/dom/DOMProperty.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probName?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gah my bad. fixed
|
(React assumes that you don't modify Object.prototype and I'm not sure why you would pass something other than a plain object here…) |
|
it is not documented anywhere (or I must have missed it) that there is such an assumption for React. Also, a previous changelog (http://facebook.github.io/react/blog/2013/07/26/react-v0-4-1.html : •Prevent a potential error in event handling if Object.prototype is extended.) seems to suggest that React would like to support environments where Object.prototype is indeed extended. My personal take is that this check isn't expensive, and will not potentially be a blocker for any current or future React features. It's a not a bad thing to be defensive |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
|
I think it may be a good idea to at least decide for one or the other, not both. It seems like the rest of the code is written defensively with |
|
Note that jQuery doesn't support modifying Object.prototype: http://contribute.jquery.org/wont-fix/#object-prototype-issues I'm inclined to do the same. |
|
JS as a language and built-in power features are going more and more towards hasOwnProperty checks to be defensive. (Like Object.keys) so I think we should do the same. In this case it doesn't have a cost. |
|
Can we get a rebase of this PR and make sure that the Travis CI build passes the build. Thanks. |
|
Closing due to inactivity, but happy to take this if it gets rebased with passing tests. |
No description provided.