-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
defineCustomElement uses incorrect props type mapping #9697
Comments
The Normal attributes are always strings. nextTick(()=>{
// when using setAttribute, use an empty string:
r.value.setAttribute('has', '')
// when setting as a DOM prop, use a boolean value:
r.value.has = true
}) Either of the above will result in the boolean prop being cast correctly. Now, we could add additional magic to properly convert |
I think we need some magic 🦄 |
I would advise against adding some conversion magic. The HTML Living Standard explicitly states:
https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes |
I personally feel that, at present, the philosophy of Vue conflicts with the HTML Living Standard. When I wrote the following code, I interpreted it with the mindset of Vue, but the outcome did not meet expectations. I believe the Vue team will make a judgment on how to choose. |
Vue is following the spec here.
|
Vue version
v3.4.0-alpha.3
Link to minimal reproduction
https://play.vuejs.org/#eNqNU02P2yAQ/SuISxzJxpXSU5SsdrfKoT20VbtHX7z2OGYXA4JxkirKf++A43wprfYEzLx5PN4Me/5krdj0wOd84SsnLTIP2NuHQsvOGodsz2popIYvvUfTrRR0oDEdg4ZAOgbalDloUqZhhy+yemcH1jjTsQmxTwpdGe2RObYMqGQ6Bq5YKXlDm+wLzZh1xvp53DLWln7OjnvG8I+FOXs2RkGp0zFKLGWvcM6aUnkYooewHCLEga7BJdMji6MHO83aZFLLzSQNlKZh2Eov6DKSGosPtCn0VurabEV1KduLQXUyGcJZpLnjWnJ1mkbC0a4kmS4foiAnNqXqQVAfnhCdfO2RqEnJJGXoeqCyoGWRD/2iTtEBobOqRKDTgq6nhbHFWU4wfVlwV/A8IPIBsshPZTzl6KkljVyLN280zUMUU/CKeiEVuB8WJbWs4Cf3C14qZbbfYiwoO/pPNS1U73fib34XYgX/6cCD20DBTzks3RpwSK9+fydbLpKdqXtF6P8kf4E3qg8aB9hzr2uSfYGLar/GqZZ6/eJXOwTtx0cFoecRKTiNbRjDfz39LHcmZuOIkIvDr8m60t74OCSuSeiOQWyLSBOe51WtqawGJTdOaMBc2y5/JFjueo2yg6w23eNMfBafslLZthQz6qXHy7QA32WvzmzJYUFfpybGCxcCWfTeZcM/CB59TMNN2T0dN5ArLUHGyanDX/rIhwA=
Steps to reproduce
Not needed
What is expected?
According to the document description, it should actually be of type
Boolean
What is actually happening?
Page displays
string
System Info
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: