-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Description
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.