According to the HTML5 spec:
The values "true" and "false" are not allowed on boolean attributes. To represent a false value, the attribute has to be omitted altogether.
So, in order to make my code spec compatible, i'd do in this way in vue: <input :checked="checked ? '' : false">, do you think it is necessary to directly support boolean attributes in vue? @yyx990803
Solutions I can think of are these:
v-add:selected="true" (not recommand)v-bind:selected.boolean="true" (recommand)v-bind:selected="true", we need to mantain a boolean attribute list(see), and this may have compatibility problems.Again, if you think it is necessary, let me handle this! :trollface:
What's the problem with <input :checked="checked">? Vue removes the attribute if checked is falsy.
Well, <input checked="true"> and <input checked="1"> are invalid in HTML(although they can work in most browsers), only <input checked> and <input checked="checked"> are valid.
Ok, I guess the modifier is the best way to go. Should be easy too. PR welcome :)
What about the modifier name? is .boolean ok?
Yeah I think so.
By the way, could you email me your email address? it would be more convenient talk in my native language. XD
+1 😺
@rhyzx Thank you for posting your issues in English! :smile:
@posva wel ;)
Most helpful comment
What's the problem with
<input :checked="checked">? Vue removes the attribute ifcheckedis falsy.