axe-core icon indicating copy to clipboard operation
axe-core copied to clipboard

Runtime issue: n.nodeName.toLowerCase is not a function

Open acsardi opened this issue 4 months ago • 6 comments

<< Please describe how you encountered this issue >>

axe-core version: 4.10.3 axe-extension version: 4.113.4

TypeError: n.nodeName.toLowerCase is not a function
    at e (chrome-extension://lhdoppojpmngadmnindnejefpokejbdd/axe-versions/latest/axe.js:2:301684)
    at i (chrome-extension://lhdoppojpmngadmnindnejefpokejbdd/axe-versions/latest/axe.js:2:301602)
    at chrome-extension://lhdoppojpmngadmnindnejefpokejbdd/axe-versions/latest/axe.js:2:302356
    at Array.reduce (<anonymous>)
    at e (chrome-extension://lhdoppojpmngadmnindnejefpokejbdd/axe-versions/latest/axe.js:2:302327)
    at i (chrome-extension://lhdoppojpmngadmnindnejefpokejbdd/axe-versions/latest/axe.js:2:301602)
    at chrome-extension://lhdoppojpmngadmnindnejefpokejbdd/axe-versions/latest/axe.js:2:302356
    at Array.reduce (<anonymous>)
    at e (chrome-extension://lhdoppojpmngadmnindnejefpokejbdd/axe-versions/latest/axe.js:2:302327)
    at i (chrome-extension://lhdoppojpmngadmnindnejefpokejbdd/axe-versions/latest/axe.js:2:301602)

acsardi avatar Aug 21 '25 07:08 acsardi

Thanks for the issue. I've actually never seen this error message before. Is the site where this happened public that I could look at? From the message my guess is that some JavaScript code is overriding native Node features as we would expect a node object to have a nodeName property.

straker avatar Aug 21 '25 14:08 straker

The issue was caused by a field using nodeName as its name attribute. Changing this value resolved the problem.

acsardi avatar Aug 22 '25 08:08 acsardi

Interesting. So the field looked like this and it threw the error? If so I think this would be something we might want to look out for in the future.

<form><input name="nodeName"/></form>

straker avatar Aug 22 '25 13:08 straker

@straker I would like to work on this - can you please guide on the fix approach ?

i) I assume the fix would have to be generic, i.e extend to any name conflicts, and not just handle nodeName conflict ? ii) Would the approach be to catch this sort of error, and instead report a message like Please use a different name for the <nodeName> attribute as this is reserved ?

If the above sounds good, will get started on the fix.

namansancheti avatar Nov 06 '25 06:11 namansancheti

I'm not sure yet what approach we'll want to take to handle this. At the moment I believe these problems can only happen on form elements. We've already had to deal with this issue with the attributes property, but we don't want to do the same for this. We haven't looked into how we want to handle this yet since we will probably need to do something special for any form element we encounter, and will need to apply it throughout the code base.

For now I don't think this ticket is ready for outside contributors to take on.

straker avatar Nov 06 '25 16:11 straker

@straker Got it, thanks for letting me know 👍

namansancheti avatar Nov 07 '25 04:11 namansancheti