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

Improve addEventListener and removeEventListener support. #11

Merged
merged 2 commits into from
Nov 12, 2013

Conversation

pazguille
Copy link
Contributor

event checks if addEventListener and removeEventListener methods are supported by the browser, just once. Also, checks if the event need the prefix on.

Thanks.

@TooTallNate
Copy link
Member

We need some benchmark results showing this is faster in order to merge this.

@pazguille
Copy link
Contributor Author

http://jsperf.com/event-component Done! :)

@TooTallNate
Copy link
Member

Seems fine to me then. Could probably be even more optimized by defining separate hard-coded paths for each version, but this is an improvement. Thanks!

TooTallNate added a commit that referenced this pull request Nov 12, 2013
Improve addEventListener and removeEventListener support.
@TooTallNate TooTallNate merged commit 79c9427 into component:master Nov 12, 2013
@@ -1,3 +1,6 @@
var bind = (window.addEventListener !== undefined) ? 'addEventListener' : 'attachEvent',
unbind = (window.removeEventListener !== undefined) ? 'removeEventListener' : 'detachEvent',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parentheses are not needed, nor is the comparison with undefined.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to do a new pull request with these changes.

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.

None yet

3 participants