Skip to content

Boolean attributes #2169

Closed
Closed
@rhyzx

Description

@rhyzx

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:

  • By another directive: v-add:selected="true" (not recommand)
  • By modifier: v-bind:selected.boolean="true" (recommand)
  • Auto: 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:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions