hi,
I've had a problem trying to check a specific web page with the HTML_CodeSniffer bookmarklet and having it simply crash with an unhelpful
Unexpected javascript Error: Script error.
Url: http://squizlabs.github.com/HTML_CodeSniffer/build/HTMLCS.js
Line Number: 0
and have just tracked it down to
https://github.com/squizlabs/HTML_CodeSniffer/blob/master/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_3/1_3_1.js
where this line of code in testLabelsOnInputs(element,top) crashes if the element has a null type attribute
if (/^(submit|reset|image|hidden|button)$/.test(inputType.toLowerCase()) === true) {
From what I can work out the 'type' attribute for a form input is optional with a default of 'text'.
Relying on such a default is obviously not recommended but so is the test assuming it could not possibly be null.
Perhaps checking for null and warning might be a more helpful way to handle it?
Cheers,
Laurie