-
Notifications
You must be signed in to change notification settings - Fork 776
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
Custom rules with class selector fail on SVGElements #1423
Comments
Odd. Thank you for reporting. We'll definitely take a look at it. Out of curiosity, what are you using custom rules for? |
Thanks!
Mostly to make sure custom JS behaviors are bound to interactive elements, and that they have appropriate ARIA attributes on them. |
after hasClass 's "className !== 'string' " replaced with class attribute. And the actual bug , |
Thank you for confirming the validation. Closing the ticket as seeing the expected results |
@muan can you explain how your custom rule works? I am always interested in the rules that users create so I can take good practices and make them available to other users. If you can, could you share the code? |
@dylanb Rules for custom behaviors:
Rules for HTML tags:
We also have a simple nested interactive element rule (#601) that only checks against tag names (not checking |
Demo: https://html-is.glitch.me/axe-core.html (see console)
Expectation:
Custom rules with
selector: '.klass'
should run successfully.Actual:
Custom rules with class selectors fail with
TypeError: node.className.match is not a function.
Motivation:
Our custom rules fail because there are
<svg>
s on the page, and that should not be the case.This line causes this error:
axe-core/lib/core/utils/qsa.js
Line 18 in 60b3630
SVGSVGElement.className
returns an instance ofSVGAnimatedString
instead ofDOMString
and does not have thematch
function. As noted on MDN:Version
2.6.1
works fine and breaks in3.0.0
+.The text was updated successfully, but these errors were encountered: