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, axe-core assumes it runs in the browser and thus it assumes it has access to all default browser. Things like window and document are required for axe-core to run.
This creates a challenge when using axe-core with things like JSDOM. To use axe-core, someone has to set up a number of global variables before they can include axe-core.
This implicit reliance on globals is problematic, and can lead to issues like #1404. A much cleaner solution would be if axe-core would infer its document / window objects from whatever context it is passed:
constresults=awaitaxe.run(elm)
You can infer an element's document and what the corresponding window is. The only time we would need access to a global object is if axe.run() wasn't passed any argument, and ideally, we'd do it only once.
This is a significant piece of work. I think we would have to pass document and window objects around as arguments to check and matches functions. Alternatively we could also add those two objects to the context object. That would be a breaking change, but IMO it is a cleaner solution.
An interim solution would be for us to tighten ESLint and only allow document and window objects as globals. That would prevent a problem like we had in #1404.
The text was updated successfully, but these errors were encountered:
Currently, axe-core assumes it runs in the browser and thus it assumes it has access to all default browser. Things like
window
anddocument
are required for axe-core to run.This creates a challenge when using axe-core with things like JSDOM. To use axe-core, someone has to set up a number of global variables before they can include axe-core.
This implicit reliance on globals is problematic, and can lead to issues like #1404. A much cleaner solution would be if axe-core would infer its document / window objects from whatever context it is passed:
You can infer an element's document and what the corresponding window is. The only time we would need access to a global object is if
axe.run()
wasn't passed any argument, and ideally, we'd do it only once.This is a significant piece of work. I think we would have to pass
document
andwindow
objects around as arguments to check and matches functions. Alternatively we could also add those two objects to thecontext
object. That would be a breaking change, but IMO it is a cleaner solution.An interim solution would be for us to tighten ESLint and only allow
document
andwindow
objects as globals. That would prevent a problem like we had in #1404.The text was updated successfully, but these errors were encountered: