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
Occurred error in 'set' and 'delete' utility functions #1809
Conversation
delete
utility functions* @return {Boolean} | ||
*/ | ||
exports.hasOwnProperty = function (obj, key) { | ||
return Object.prototype.hasOwnProperty.call(obj, key) |
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.
Let's cache Object.prototype.hasOwnProperty
outside the function because this is going to be called a lot.
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.
OK !!
Should I use the Cache
?
https://github.com/vuejs/vue/blob/dev/src/cache.js
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.
No, what I mean is just hold it in a variable outside the function as var hasOwn = Object.prototype.hasOwnProperty
It probably doesn't make much difference, but saves two property lookups on every call ;)
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.
I see. :)
Thanks! A few notes:
|
Thank you for your many review!! :) I'll try 💪 |
Done. |
Looks good! Can you squash them into one commit please? |
See the #1816 :) |
we create the object with
Object.create(null)
, and after that when we useVue.util.set
orVue.util.delete
, occur the following error at these functions.Please see the following jsfiddle:
https://jsfiddle.net/kazupon/1b7nytcd/1/
This issue is related #1765
I fixed the this issue, and refactored.
Please check the PR!! 😸