WCAG 2.0 parsing error bookmarklet
While reading Jared Smith’s excellent article WCAG Next I was drawn to the following statement “next to impossible to evaluate” in reference to the checking of WCAG 2.0 success criterion 4.1.1 Parsing.
It is true (as far as I know) that there is no currently available dedicated service or software for checking 4.1.1 Parsing. What I do and advise clients to do is use the W3C validation service to check their code as the checks required for parsing criterion conformance are a subset of the checks that are made when validating HTML code.
Identifying relevant errors and warnings
A problem with using a standard HTML validator to check for this subset is that many other conformance errors and warnings are also reported and while these may or may not be important to fix, they are not a requirement within the scope of the success criterion. What I have been doing is checking pages against the HTML5 doctype as this minimizes the occurance of errors and warnings that are unrelated to parsing, but still a page can contain many non parsing errors, making it difficult to identify the relevant results.
I have also had discussions with Mike Smith (W3C Nu Markup Validation Service) and Henri Sivonen (Validator.nu) about providing a method to filter conformance results to display only parsing issues. There are apperently some design reasons why this would be difficult (not impossible) from a backend code perspective, so I thought a reasonable place to start would be with a client side script that filtered the display of results from a validator.
Parsing error bookmarklet
The WCAG parsing only bookmarklet is an experimental script that loops through the results displayed when using W3C Nu Markup Validation Service. It looks for certain text strings in the results output and if it does not find them in the text for a particular result it hides that result using CSS display:none.
Check results other than the followoing are filtered:
- Elements have complete start and end tags
- Elements are nested according to their specifications
- Elements do not contain duplicate attributes
- Any IDs are unique
- Unquoted attributes (under certain circumstances)
- Duplicate attributes
- Mismatched quotes on attributes
- Attributes not space seperated
- Mismatched element start and end tags
- malformed attributes
Trying out the parsing only bookmarklet
- save the WCAG parsing only as a bookmark.
- open the W3C Nu Markup Validation Service in your browser
- validate a page (test page)
- activate the bookmarklet
- To view the unfiltered list of results again – refresh the page
- you can download the parsing.js code
- HTML conformance checking and result filtering is also built in to the Web Accessibility Toolbar 2012
This is an experiment only, due to various constraints the method used to filter the results is not the most robust as it relies upon text string matching.
Note: this experiment would not have been possible without the help of my friends and colleagues Hans Hillen and Gez Lemon, who although they thought the method used was crappy, helped me anyway.