Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 1aa726df3b91934f42ad379cc6b01c5dc3fa6f73 1 parent 9bd0291
Nicolas Gallagher authored

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  index.js
4  index.js
@@ -12,7 +12,7 @@
12 12
 
13 13
 exports.bind = function(el, type, fn, capture){
14 14
   if (el.addEventListener) {
15  
-    el.addEventListener(type, fn, capture);
  15
+    el.addEventListener(type, fn, capture || false);
16 16
   } else {
17 17
     el.attachEvent('on' + type, fn);
18 18
   }
@@ -32,7 +32,7 @@ exports.bind = function(el, type, fn, capture){
32 32
 
33 33
 exports.unbind = function(el, type, fn, capture){
34 34
   if (el.removeEventListener) {
35  
-    el.removeEventListener(type, fn, capture);
  35
+    el.removeEventListener(type, fn, capture || false);
36 36
   } else {
37 37
     el.detachEvent('on' + type, fn);
38 38
   }

0 notes on commit 1aa726d

Please sign in to comment.
Something went wrong with that request. Please try again.