Skip to Content (Press Enter)

This document is a draft, and is designed to show changes from a previous version. It is presently showing added text,changed text,deleted text,[start]/[end] markers,and Issue Numbers.

Hide All Edits   |   Toggle Deletions  |   Toggle Issue Numbers   |   Toggle [start]/[end] Markers   |   Show All Edits

Changes are displayed as follows:

H74: Ensuring that [begin delete]all id attribute values are unique for the document AND that[end delete] opening and closing tags are used according to specification

Applicability

HTML 4.01 and XHTML 1.x.

This technique relates to:

Description

[begin change]

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 which involve having opening and closing tags that are not used according to specification. These errors can be avoided by using the HTML mechanism to specify the technology and technology version, and making sure the Web page does not have these types of errors in it. There are several validators that the developer can use: validation reports generally mention these types of errors. This technique deals only with errors related to incorrectly formed opening and closing tags. 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.

[end change]

Examples

Example 1: HTML

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 all id attribute values are unique and that opening and closing tags are used according to the specification.

Example 2: XHTML

Like other other XML-based documents, XHTML documents reference a Document Type Definition (DTD) or other type of XML schema. The developer can use online or offline validators (including validation tools built into editors) to check that [begin delete]that all id attribute values are unique and that [end delete]opening and closing tags are used according to the specification.

Example 3: Using test frameworks

When a website generates XHTML dynamically instead of serving only static pages, a developer can use XHTMLUnit, XML Test Suite or a similar framework to test the generated XHTML code.

Resources

Resources are for information purposes only, no endorsement implied.

For other resources, see G134: Validating Web pages.

(none currently listed)

Tests

Procedure

  1. Check that all id attribute values are unique.

  2. Check that there are closing tags for all elements with required closing tags.

  3. Check that there are no closing tags for all elements where closing tags are forbidden.

  4. Check that opening and closing tags for all elements are correctly nested.

Expected Results

Steps 1, 2, and 3 are true.