Permalink
Browse files

Set default `capture` to `false`

Portability is improved by ensuring that if the `capture` argument is
missing, it's set to `false` by default. Older implementations require
the third argument to be set in add/removeEventListener.
  • Loading branch information...
1 parent 9bd0291 commit 1aa726df3b91934f42ad379cc6b01c5dc3fa6f73 @necolas necolas committed Feb 14, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 index.js
View
4 index.js
@@ -12,7 +12,7 @@
exports.bind = function(el, type, fn, capture){
if (el.addEventListener) {
- el.addEventListener(type, fn, capture);
+ el.addEventListener(type, fn, capture || false);
} else {
el.attachEvent('on' + type, fn);
}
@@ -32,7 +32,7 @@ exports.bind = function(el, type, fn, capture){
exports.unbind = function(el, type, fn, capture){
if (el.removeEventListener) {
- el.removeEventListener(type, fn, capture);
+ el.removeEventListener(type, fn, capture || false);
} else {
el.detachEvent('on' + type, fn);
}

0 comments on commit 1aa726d

Please sign in to comment.