Skip to content
Andrew Hick edited this page Jul 25, 2023 · 7 revisions

4.1.1 Parsing

In content implemented using markup languages, elements have complete start and end tags, elements are nested according to their specifications, elements do not contain duplicate attributes, and any IDs are unique, except where the specifications allow these features.

When this is applicable

Always.

Check for certain validation errors

Use the W3C HTML validator bookmarklets to first "Check serialized DOM of current page" and then to "Check for WCAG 2.0 parsing compliance".

If the page is dynamic (changes or adapts), check different versions of the page.

Double check the output while keeping in mind that:

  • the validator can have bugs
  • the parsing compliance is experimental and occasionally reports validation errors that are not WCAG fails

This requires good knowledge of HTML and ARIA.

Other ways to check

If you cannot use the "Check serialized DOM of current page" bookmarklet, you can manually check:

  • there is a doctype - if there is not, it's a fail
  • the code that the browser sees with JS with the View Rendered Source extension (do not just use 'view source')
  • the rendered source in a validator

If you cannot use the "Check for WCAG 2.0 parsing compliance" bookmarklet, manually check:

  • elements have complete start and end tags
  • elements are nested correctly (this one is difficult to do without knowledge of the markup language, best check with someone who knows it well or check the specification; be aware some ARIA attributes can change which elements can be nested in which way, axe usually picks those up, or the WAI-ARIA usage bookmarklet can help)
  • elements do not have duplicate attributes
  • IDs (id="...") are unique

Exceptions

Ignore custom attributes. This needs good awareness of the markup language. You can check the list of standard attributes.

Best practice

It is a good idea to fix most invalid HTML.

Mobile app testing

This guideline only applies to content in markup languages such as HTML. It is unclear how to test this on mobile apps.

If using Android, the Android accessibility scanner might pick up some failures.