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

this.Element fails when EventListener.js is 'required' #21

Open
ianmcgregor opened this issue Sep 10, 2014 · 1 comment
Open

this.Element fails when EventListener.js is 'required' #21

ianmcgregor opened this issue Sep 10, 2014 · 1 comment

Comments

@ianmcgregor
Copy link

Hey, this seems to be the best polyfill out there for ie8. Thanks 👍

Found one issue, related to pulling the lib in as a module. For example:

require('../bower_components/eventlistener-polyfill/EventListener.js');

In this scenario the this at the beginning of the first line will refer to the module scope rather than window as intended. Changing it to window or just removing it solves the problem:

window.Element && Element.prototype.attachEvent && !Element.prototype.addEventListener

or

Element && Element.prototype.attachEvent && !Element.prototype.addEventListener
@JamesMGreene
Copy link

You may also want to check on jonathantneal/polyfill. IIRC, @jonathantneal tends to keep that "collection"-style repo more up-to-date than these individual functionality repos.

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

No branches or pull requests

2 participants