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

.prop v-bind modifier shorthand throws DOMException #11375

Closed
au-z opened this issue May 5, 2020 · 3 comments
Closed

.prop v-bind modifier shorthand throws DOMException #11375

au-z opened this issue May 5, 2020 · 3 comments

Comments

@au-z
Copy link

au-z commented May 5, 2020

Version

2.6.11

Reproduction link

Codesandbox: vue-hybrids .prop shorthand

Steps to reproduce

If you uncomment the second element, you'll see an error:

DOMException: Failed to execute 'setAttribute' on 'Element': '.num' is not a valid attribute name.

What is expected?

.num should be an equivalent shorthand for :num.prop

What is actually happening?

Vue throws a DOMException when trying to set a .num attribute on the element during render.


It appears that this feature was added as a feature request for 2.6:
#7582

There, @trusktr documented that because . characters are disallowed in attribute names, the shorthand syntax would not "...get in the way of DOM usage."

I believe the error this time around is that the Vue render function is parsing the .num attribute and attempting to set the same attribute in the DOM without first checking for the .prop shorthand and attempting to set the property of the rendered element directly.

@posva
Copy link
Member

posva commented May 5, 2020

It looks like this was added on https://github.com/vuejs/vue/releases/tag/v2.6.0-beta.1 but never made it to the next release v2.6.0

@au-z
Copy link
Author

au-z commented May 5, 2020

Oh bummer. Any indication as to why it didn't make it? It would be a killer syntax feature and much appreciated among Vue users looking to instrument their templates with components.

@posva
Copy link
Member

posva commented Jun 3, 2021

Maybe it's worth reviving the topic on the RFCS repository

@posva posva closed this as completed Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants