Allow non-string values as context. #17
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR removes the
const el = document.querySelector(selector);
statement for the following reasons:axe-core
'scontext
argument is really powerful and supports the input in a lot of varied formats, but having the above statement limits the first argument of.axeRun()
command to only acceptstring
input.document.querySelector()
limits the axe check to only one matching DOM node and that's it. So, if we want to check some elements for accessibility that have the same class name, it will always choose the first matching node only and the other matching nodes will remain untested. Also, to check for multiple elements with unique CSS selectors, we would need to run.axeRun()
command multiple times as we cannot pass all the selectors once (which is supported by axe-core by separating multiple CSS selectors by,
).Since I am unaware, is there a reason why the above-mentioned statement was included in the code in the first place?