Disallows duplicated attributes on same element

Rule ID:
no-dup-attr
Category:
HTML Syntax and concepts
Standards:
  • HTML5

HTML disallows two or more attributes with the same (case-insensitive) name.

Browsers handles duplication differently and thus this is a source for bugs.

Rule details

Examples of incorrect code for this rule:

<div class="foo" class="bar"></div>
error: Attribute "class" duplicated (no-dup-attr) at inline:1:18:
> 1 | <div class="foo" class="bar"></div>
    |                  ^^^^^


1 error found.

Examples of correct code for this rule:

<div class="foo bar"></div>