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

Internal method overriding detection #4142

Closed
Leopoldthecoder opened this issue Nov 7, 2016 · 2 comments
Closed

Internal method overriding detection #4142

Leopoldthecoder opened this issue Nov 7, 2016 · 2 comments

Comments

@Leopoldthecoder
Copy link

2.0.5 introduced a feature that Vue warns if user is trying to override an internal method. It's a good thing, though I think the current detecting implementation is debatable.

According to this commit, every method on Vue's prototype is checked. But not everything there is necessarily an internal method. For example, if I manually add a method to Vue.prototype, and try to manipulate this method later on, I'll get a warning. Same thing happens when a third party package adds some method to Vue.prototype.

Such cases can be confusing because the method that gets warned is not actually shipped with Vue itself. Any chance this will get improved?

@HerringtonDarkholme
Copy link
Member

Hi, I have considered this case in this commit. My opinion is that if a third library added a method on Vue's prototype, the library author probably don't want it get changed by end users. Can you elaborate your situation more?
If that will be long, we can migrate it to forum. https://forum.vuejs.org/

@Leopoldthecoder
Copy link
Author

My opinion is that if a third library added a method on Vue's prototype, the library author probably don't want it get changed by end users.

Agreed. I see the discussion in #4111, and I think detecting methods that starts with $ or _ is a good approach. Closing this issue now.

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

No branches or pull requests

3 participants