Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/non browser environment #11

Merged
merged 2 commits into from
Dec 21, 2015

Conversation

rodneyrehm
Copy link
Contributor

I use this module in ally.js and have come across a problem (medialize/ally.js#92) when loading domtokenlist-shim in an environment other than a browser (Node, WebWorker, …). The module doesn't have to do anything in these environments, it should just not throw any errors because window doesn't exist. By adding typeof window != 'undefined' && to your IIFEs, the module does not execute in Node.

This is PR a quick-n-dirty "fix" and the following is likely a different issue: We may want to use src/DOMTokenList.js separately of the DOM. To make that possible, the module needs to be wrapped in UMD and return the object, rather than assign it to window. Is that something you could agree to?

@jwilsson
Copy link
Owner

Cool! I read about ally.js the other week, glad to see some real world usage 😄

Wrapping it with UMD is definitely something I'm interested in, I'm just a bit worried about the extra bytes it brings. I'll open up a new issue for discussion on that.

But the patch looks good, thank you!

jwilsson added a commit that referenced this pull request Dec 21, 2015
@jwilsson jwilsson merged commit 5aabf20 into jwilsson:master Dec 21, 2015
@jwilsson jwilsson mentioned this pull request Dec 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants