Attribute is not duplicated

  • Rule Type:atomic
  • Rule Id: e6952f
  • Last modified: Aug 24, 2020
  • Accessibility Requirements Mapping:
    • 4.1.1 Parsing (Level A)
      • Learn More about 4.1.1 Parsing
      • Required for conformance to WCAG 2.0 and later on level A and higher.
      • Outcome mapping:
        • Any failed outcomes: success criterion is not satisfied.
        • All passed outcomes: success criterion needs further testing.
        • An inapplicable outcome: success criterion needs further testing.
    • H94: Ensuring that elements do not contain duplicate attributes
      • Learn More about technique H94
      • Not required to conformance to any W3C accessibility recommendation.
      • Outcome mapping:
        • Any failed outcomes: technique is not satisfied.
        • All passed outcomes: technique is satisfied.
        • An inapplicable outcome: technique is satisfied.
  • Input Aspects:

Description

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

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

Open in a new tab

No attributes are duplicated.

<img src="/test-assets/shared/w3c-logo.png" alt="W3C logo" />

Passed Example 2

Open in a new tab

No attributes, therefore no attributes are duplicated.

<br />

Passed Example 3

Open in a new tab

Empty attributes, no attributes are duplicated.

<input type="checkbox" disabled readonly />

Passed Example 4

Open in a new tab

SVG, no attributes are duplicated.

<svg>
	<line x1="0" y1="0" x2="200" y2="200" style="stroke-width:2" />
</svg>

Passed Example 5

Open in a new tab

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

<script>
	var foo = '<img src="/test-assets/shared/w3c-logo.png" alt="" alt="W3C logo" />'
</script>

Failed

Failed Example 1

Open in a new tab

At least one attribute is duplicated.

<img src="/test-assets/shared/w3c-logo.png" alt="" alt="W3C logo" />

Failed Example 2

Open in a new tab

Empty attributes, at least one attribute is duplicated.

<input type="checkbox" disabled="disabled" disabled readonly />

Failed Example 3

Open in a new tab

SVG, at least one attribute is duplicated.

<svg>
	<line x1="0" y1="0" x1="200" y1="200" style="stroke-width:2" />
</svg>

Inapplicable

Inapplicable Example 1

Open in a new tab

Code is XML, and not HTML or SVG.

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:earl="http://www.w3.org/ns/earl#">
  <earl:TestResult rdf:about="#result"></earl:TestResult>
</rdf:RDF>

Inapplicable Example 2

Open in a new tab

Code is JavaScript, and not HTML or SVG.

var foo = '<img src="/test-assets/shared/w3c-logo.png" alt="" alt="W3C logo" />'

Glossary

Outcome

An outcome is a conclusion that comes from evaluating an ACT Rule on a test subject or one of its constituent test target. An outcome can be one of the three following types:

  • Inapplicable: No part of the test subject matches the applicability
  • Passed: A test target meets all expectations
  • Failed: A test target does not meet all expectations

Note: A rule has one passed or failed outcome for every test target. When there are no test targets the rule has one inapplicable outcome. This means that each test subject will have one or more outcomes.

Note: Implementations using the EARL10-Schema can express the outcome with the outcome property. In addition to passed, failed and inapplicable, EARL 1.0 also defined an incomplete outcome. While this cannot be the outcome of an ACT Rule when applied in its entirety, it often happens that rules are only partially evaluated. For example, when applicability was automated, but the expectations have to be evaluated manually. Such "interim" results can be expressed with the incomplete outcome.


Useful Links


Implementations

This section is not part of the official rule. It is populated dynamically and not accounted for in the change history or the last modified date. This section will not be included in the rule when it is published on the W3C website.

No Implementations

Implementation reports are not provided for this rule.

Acknowledgments

Table of Contents