--- obsoleteMessage: | This technique relates to 4.1.1: Parsing, which was removed as of WCAG 2.2. obsoleteSince: 22 --- Ensuring that elements do not contain duplicate attributes

Ensuring that elements do not contain duplicate attributes

ID: H94

Technology: html

Type: Technique

When to Use

All HTML pages

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

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 validator, for example, will report Error duplicate attribute [attribute name] when it encounters the second definition of the same attribute on an element.

Tests

Procedure

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

Expected Results

Expected Results

Resources

For other resources, see G134: Validating Web pages.