No Duplicate Attributes

ID

html.attr_no_duplication

Severity

high

Remediation Complexity

trivial

Remediation Risk

low

Remediation Effort

low

Resource

Reliability

Language

Html

Tags

reliability

Description

Flags an opening element that declares the same attribute name twice or more. The comparison is case-insensitive on the attribute short name.

Rationale

Duplicate attributes are a parse error in HTML. The browser keeps only the first occurrence and silently drops the rest, so the markup does not behave as written. The duplication is almost always a copy-paste mistake that masks the author’s real intent.

<input type="text" type="password">   <!-- FLAW — type declared twice, stays a text field -->

<input type="password" name="pwd">    <!-- OK — each attribute declared once -->

Remediation

Remove the redundant attribute and keep the single occurrence that carries the intended value.