dequelabs / dequelabs/axe-core

Consider not exporting global if AMD or CommonJS module definition succeeded.

Open
#2,052 10 comments 0 reactions 1 assignee Claimed by @straker View on GitHub
breaking change
Dominant language
JavaScript
Stars
7.5k
Forks
933
Avg merge
2d 23h
Merged PRs (30d)
17

Description

Expectation: When loading axe as an AMD module, I don't expect to also have a global variable named 'axe'

Actual: Axe always export unconditionally on window when in browser context.

Motivation: Exporting on window can cause axe to override an existing value assigned to this name ('axe' is quite short and could be realistically picked as a name by a bundler/minifier for large enough bundles)

Code is here: https://github.com/dequelabs/axe-core/blob/deed0f150680dccf20c3199410a6f00960a202dd/lib/core/index.js#L26

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.