-
Notifications
You must be signed in to change notification settings - Fork 779
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
feat(matches): use VirtualNode and deprecate HTMLElement #1988
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of minor points.
assert.isTrue( | ||
fromDefinition(node, { | ||
fromDefinition(virtualNode.actualNode, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why aren't you passing virtualNode itself in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the test suite is making sure it still works with actual nodes passed in (backwards compatibility)
Allow VirtualNode to be used in
and
axe.commons.matches
. I also addedaxe.utils.matches
which is a VirtualNode implementation ofElement.matches
so we could handle CSS selectors in the matches function. It's mostly a copy paste of the QSA code with a slight modification to handle working up the parent tree for selectors. I thought about replacing ouraxe.utils.matchesSelector
code with the new implementation, but it would technically be a breaking change as we restrict the allowed combinators to just>
as well as which pseudos we support to just:not
.axe.utils.convertExpression
is just a copy paste from the QSA code to convert CSS selectors to the expression object we use in QSA and nowutils.matches
. I didn't want to add it oraxe.utils.matchesExpression
to the public API (since they are only used as shared code), but I was unsure how to have both QSA and matches share functions.Closes issue: #1967
Reviewer checks
Required fields, to be filled out by PR reviewer(s)