export.js: Export in all CommonJS environments

Closes #521
Per code conventions and general javascript syntax, the `typeof` is only necessary when evaluating a (potentially unknown) global identifier. So you'd use either `typeof document !== "undefined" && document` or (since this code seems to prefer using the global object as access proxy) use `window.document` (absent properties default to yielding `undefined`).