Why Does window.exports Unexpectedly Exist?

Written by Ken Dale
1
This post is days old.

We ran across an issue where window.exports was being unexpectedly set.

The cause

<div id="exports">
  ...
</div>

Why?

In some browsers, DOM elements with ids are available as variables automatically on window. When combined with functionality that checks if window.exports exists as part of environment detection there’s the potential for an issue.

See https://stackoverflow.com/questions/3434278/do-dom-tree-elements-with-ids-become-global-variables for more details.

Suggested reading

Comments