Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'indexOf' of undefined #1397

Closed
patrickhulce opened this issue Mar 1, 2019 · 2 comments
Closed

TypeError: Cannot read property 'indexOf' of undefined #1397

patrickhulce opened this issue Mar 1, 2019 · 2 comments
Labels
core Issues in the core code (lib/core) fix Bug fixes

Comments

@patrickhulce
Copy link

patrickhulce commented Mar 1, 2019

Run axe on https://www.homeyou.com/

Actual: Fails immediately with

TypeError: Cannot read property 'indexOf' of undefined
    at te (chrome-extension://<id>/adapter.bundle.js:76:59210)
    at Array.filter (<anonymous>)
    at a (chrome-extension://<id>/adapter.bundle.js:76:61464)
    at Object.H.utils.getSelectorData (chrome-extension://<id>/adapter.bundle.js:76:61665)
    at Object.q [as _runRules] (chrome-extension://<id>/adapter.bundle.js:76:35171)
    at Object.H.run (chrome-extension://<id>/adapter.bundle.js:76:37333)
    at Object.analyze (chrome-extension://<id>/adapter.bundle.js:99:285715)
    at chrome-extension://<id>/adapter.bundle.js:99:284178
    at onMessage (chrome-extension://<id>/browser-polyfill.js:1056:22)

Expectation: Run completes without error

Motivation: GoogleChrome/lighthouse#7355


axe-core version: 3.1.2
axe-webdriver, extension or other integration version: 3.7.0

Browser and Assistive Technology versions
Chrome 72.0.3626.119
@WilcoFiers
Copy link
Contributor

Howdy! Thank you. I've been aware this existed for a while now but never found a place to reproduce it. We'll be sure to have a look.

@WilcoFiers WilcoFiers added fix Bug fixes core Issues in the core code (lib/core) labels Mar 1, 2019
@straker
Copy link
Contributor

straker commented Mar 13, 2019

So the issue is caused by one of the form elements on the page clobbering the DOM and overriding node.attributes.

<form>
   <select name="attributes">
</form>

This causes node.attributes to return the <select> element instead of a NamedNodeMap. To fix this we just have to check that node.attributes is an instanceof NamedNodeMap before we loop over it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Issues in the core code (lib/core) fix Bug fixes
Projects
None yet
Development

No branches or pull requests

3 participants