You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the imported cssSelectorParser is only registered to handle the nesting operator >, but our querySelectorAll code can handle more complex selectors and pseudo selectors. This means that even though we can handle it, trying to run axe.utils.querySelectorAll(virtualNode, 'a[href^="#"]') throws an error in the cssSelectorParser as it doesn't expect the ^.
We should update the registration of the cssSelectorParser and allow the :not pseudo selector as well as the matching selectors ^=, $=, ~=, |=, and *=.
Expectation: axe.utils.querySelectorAll(virtualNode, 'a[href^="#"]') should return all hrefs that don't start with #
Actual: cssSelectorParser throws an error
Motivation: Can reduce matches logic by being able to filter out results in the selector, as well as being able to use more complex selectors
axe-core version: 3.2.2
The text was updated successfully, but these errors were encountered:
Updates the CSS Selector Parser to allow more complex selectors: `:not`, `^=`, `$=`, and `*=`. Also update docs to describe what selectors we support.
Closes: #1493
## Reviewer checks
**Required fields, to be filled out by PR reviewer(s)**
- [x] Follows the commit message policy, appropriate for next version
- [x] Has documentation updated, a DU ticket, or requires no documentation change
- [x] Includes new tests, or was unnecessary
- [x] Code is reviewed for security by: @WilcoFiers
Currently the imported cssSelectorParser is only registered to handle the nesting operator >, but our
querySelectorAll
code can handle more complex selectors and pseudo selectors. This means that even though we can handle it, trying to runaxe.utils.querySelectorAll(virtualNode, 'a[href^="#"]')
throws an error in the cssSelectorParser as it doesn't expect the^
.We should update the registration of the cssSelectorParser and allow the
:not
pseudo selector as well as the matching selectors^=
,$=
,~=
,|=
, and*=
.Expectation:
axe.utils.querySelectorAll(virtualNode, 'a[href^="#"]')
should return all hrefs that don't start with#
Actual: cssSelectorParser throws an error
Motivation: Can reduce matches logic by being able to filter out results in the selector, as well as being able to use more complex selectors
The text was updated successfully, but these errors were encountered: