Skip to content

Warn (or tidy) poorly formed boolean attributes #796

Open
@brennanyoung

Description

@brennanyoung

Given that the only valid value for a boolean attribute is the name of the attribute or empty string, it would be useful if tidy would warn about cases such as:

hidden="false"

At first glance this looks meaningful, but hidden="false" means the same as
hidden="hidden", hidden="" and hidden="true" which is not at all intuitive.

It should be better known that the value of a boolean attribute is always treated as true if present, regardless of the attribute value. If our markup-tidying tools spotted those kinds of mistakes, it would be useful.

Here's a (possibly complete?) list of boolean attributes in html5:

allowFullscreen
async
autofocus
autoplay
checked
compact
controls
declare
default
defaultChecked
defaultMuted
defaultSelected
defer
disabled
draggable
enabled
formNoValidate
hidden
indeterminate
inert
isMap
itemScope
loop
multiple
muted
noHref
noResize
noShade
noValidate
noWrap
open
pauseOnExit
readOnly
required
reversed
scoped
seamless
selected
sortable
spellcheck
translate
trueSpeed
typeMustMatch
visible

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions