CodeQL documentation

Duplicate HTML element attributes

ID: js/duplicate-html-attribute
Kind: problem
Security severity: 
Severity: warning
Precision: very-high
   - maintainability
   - readability
Query suites:
   - javascript-security-and-quality.qls

Click to see the query in the CodeQL repository

According to the HTML5 standard, an HTML element must not have two or more attributes with the same name. If the attribute values are the same, this is most likely harmless, but it may indicate a copy-paste mistake.


Inspect the element in question and delete all but one of the redundant attributes.


The following HTML snippet contains an anchor element with a redundant href attribute:

<a href="" href="">Semmle</a>

The redundancy can be resolved by deleting one of the attributes:

<a href="">Semmle</a>


  • © GitHub, Inc.
  • Terms
  • Privacy