Last updated:

Created by:

Success Criterion:

Description

This rule checks that HTML and SVG starting tags do not contain duplicated attributes.

Accessibility Requirements

This conformance rule relates to:

Applicability

The rule applies to any starting tag in an HTML or SVG document.

Note: This rule cannot be tested on the DOM Tree because the browser removes duplicates of any attribute that is already present on an element.

Expectation

For each test target, there are no duplicated attributes.

Assumptions

There are currently no assumptions.

Accessibility support

There are no major accessibility support issues known for this rule.

Background

Test Cases

Passed

Passed example 1

No attributes are duplicated.

Code Snippet:
 <img src="image.jpg" alt="" />
 
Example Output: Open in a new tab/ window

Passed example 2

No attributes, therefore no attributes are duplicated.

Code Snippet:
 <br />
 
Example Output: Open in a new tab/ window

Passed example 3

Empty attributes, no attributes are duplicated.

Code Snippet:
 <input type="checkbox" disabled readonly />
 
Example Output: Open in a new tab/ window

Passed example 4

SVG, no attributes are duplicated.

Code Snippet:
 <svg>
  <line x1="0" y1="0" x2="200" y2="200" style="stroke-width:2" />
</svg>
 
Example Output: Open in a new tab/ window

Passed example 5

Script, no attributes are duplicated. HTML or SVG code within a script should be ignored.

Code Snippet:
 <script>
	var foo = '<img src="image.jpg" alt="" alt="image" />'
</script>
 
Example Output: Open in a new tab/ window

Failed

Failed example 1

At least one attribute is duplicated.

Code Snippet:
 <img src="image.jpg" alt="" alt="image" />
 
Example Output: Open in a new tab/ window

Failed example 2

Empty attributes, at least one attribute is duplicated.

Code Snippet:
 <input type="checkbox" disabled="disabled" disabled readonly />
 
Example Output: Open in a new tab/ window

Failed example 3

SVG, at least one attribute is duplicated.

Code Snippet:
 <svg>
  <line x1="0" y1="0" x1="200" y1="200" style="stroke-width:2" />
</svg>
 
Example Output: Open in a new tab/ window

Inapplicable

Inapplicable example 1

Code is XML, and not HTML or SVG.

Code Snippet:
 <?xml version="1.0" encoding="UTF-8"?>
<earl:TestResult rdf:about="#result"></earl>
 
Example Output: Open in a new tab/ window

Inapplicable example 2

Code is JavaScript, and not HTML or SVG.

Code Snippet:
 var foo = '<img src="image.jpg" alt="" alt="image" />'
 
Example Output: Open in a new tab/ window

Test Aspects

Test aspects are defined as part of the ACT Rules format 1.0.
  • Source code

Contribute






GitHub

Contributing is open to anyone. We welcome any new issues or pull requests for changes. Auto WCAG Rules has conference calls every 4 weeks. If you are interested in becoming an active contributor or reviewer, we ask that you join the Auto WCAG Rules community group through the W3C Website. This requires setting up a W3C account, may require approval by the organization you work for if they are a W3C member.

Learn more about contributing to Auto WCAG Rules Join the Auto WCAG Rules community group now!