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

Vue treat every element attribute named like 'v-[something]' as directive #8733

Open
mcekiera opened this issue Aug 30, 2018 · 3 comments
Open

Comments

@mcekiera
Copy link

Version

2.5.17

Reproduction link

http://jsfiddle.net/wf48v9de/3/

Steps to reproduce

Run the fiddle and look at console.

What is expected?

If there is not registered directive named 'v-fake', Vue should ignore this attribute of an element.

What is actually happening?

Vue treat every 'v-[something]' attribute as directive, regardless if it is registered globally or locally, or not at all. It is trying to compute the value of 'v-' beginning attribute, and in effect throws TypeError, as it doesn't find property named like string passed to attribute.


if it is intentional, there should be information about such behavior in Vue docs. However in my opinion it should ignore such attributes.

@kayandra
Copy link

IMHO, I think the docs are clear enough. The v-* lookup has a good behavior. It makes debugging easier, if you want to add a property v-something and not want Vue to treat it as a directive, you should be using data attributes

So instead of <div v-fake/> it should be <div data-v-fake/>

@posva
Copy link
Member

posva commented Aug 31, 2018

Maybe it would make more sense to resolve the directive and show an error (like when there is no value)

@kayandra
Copy link

@posva I guess that could work.

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