Ensuring that elements do not contain duplicate attributes

Important Information about Techniques

See Understanding Techniques for WCAG Success Criteria for important information about the usage of these informative techniques and how they relate to the normative WCAG 2.1 success criteria. The Applicability section explains the scope of the technique, and the presence of techniques for a specific technology does not imply that the technology can be used in all situations to create content that meets WCAG 2.1.

Applicability

All HTML pages

This technique relates to Success Criterion 4.1.1: Parsing (Sufficient, together with H74: Ensuring that opening and closing tags are used according to specification and H93: Ensuring that id attributes are unique on a Web page as a way to meet an unwritten technique).

Description

The objective of this technique is to avoid key errors that are known to cause problems for assistive technologies when they are trying to parse content that has duplicate attributes on the same element. This can be checked manually, or by using HTML's mechanism to specify the technology and technology version and validating the document for this condition. There are several validators that the developer can use; validation reports generally mention this type of error. The document type declaration is not strictly necessary for this type of evaluation, but specifying the document type declaration makes it easier to use a validator.

Examples

Example 1: HTML Validators

HTML pages include a document type declaration (sometimes referred to asĀ !DOCTYPE statement). The developer can use offline or online validators (see Resources below) to check that attributes are only used once on an element. The W3C validador, for example, will report "duplicate specification of attribute X" when it encounters the second definition of the same attribute on an element.

Resources

Resources are for information purposes only, no endorsement implied.

For other resources, see G134: Validating Web pages.

Tests

Procedure

  1. Check that no attribute occurs more than once on any element

Expected Results

  • Check 1 is true.