GoogleChrome/accessibility-developer-tools — pull request #28 by rachelshe (2013-08-28 22:33:14+00:00)
Title: fix for document.evaluate while inside an iframe

Four changes:

1. bugfix for src/audits/PageWithoutTitle.js . We're asking for title[0] but title = head.querySelector(...) and that only returns one element. Use querySelectorAll instead.

2. In src/audits/LowContrast.js we're running document.evaluate even though 'scope' might be inside an iframe. This leads to a NS_ERROR_DOM_WRONG_DOCUMENT_ERR ("Node cannot be used in a document other than the one in which it was created") in Firefox.We can use scope.ownerDocument to find the appropriate #document for the scope node and then run .evaluate on that. Though scope.ownerDocument returns null if scope is itself a document (sigh) so we need to check for that as well.

3. Same as above for src/js/Properties.js. BTW, I get a warning here about "Property evaluate never defined on element" which seems silly because I explicitly check if element.nodeType == Node.DOCUMENT_NODE before running .evaluate.

4. Re-generated axs_testing.js. Checked these changes using Puppeteer and FF -- no errors :)