Skip to content

duplicate-attr

Added in 0.2.9 · Related issues · View source

What it does

Checks for the same attribute name appearing more than once on an HTML element.

Why is this bad?

HTML defines attribute names as case-insensitive and an element may contain a given attribute at most once. When duplicates are present, browsers keep the first occurrence and silently discard the rest, which usually does not match the author's intent.

Example

<br class="a" id="asdf" class="b" />

Use instead:

<br class="a b" id="asdf" />

References