From 0c8ecc27e7833074da692a75596c281f1a040614 Mon Sep 17 00:00:00 2001 From: James Newell Date: Fri, 16 Jan 2015 13:21:32 +1100 Subject: [PATCH 1/2] check the delegateTarget disabled property --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 0500bf9..6385254 100644 --- a/index.js +++ b/index.js @@ -23,7 +23,11 @@ exports.bind = function(el, selector, type, fn, capture){ return event.bind(el, type, function(e){ var target = e.target || e.srcElement; e.delegateTarget = closest(target, selector, true, el); - if (e.delegateTarget) fn.call(el, e); + if (e.delegateTarget) { + if (e.delegateTarget.disabled !== true) { + fn.call(el, e); + } + } }, capture); }; From 62c53a629259c4911e2a17e504a3b21424a57783 Mon Sep 17 00:00:00 2001 From: James Newell Date: Fri, 3 Jul 2015 09:51:23 +1000 Subject: [PATCH 2/2] only ignore clicks on disabled inputs/buttons --- index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 6385254..b71d56d 100644 --- a/index.js +++ b/index.js @@ -24,9 +24,14 @@ exports.bind = function(el, selector, type, fn, capture){ var target = e.target || e.srcElement; e.delegateTarget = closest(target, selector, true, el); if (e.delegateTarget) { - if (e.delegateTarget.disabled !== true) { - fn.call(el, e); + + //ignore click events on buttons with the disabled attribute because IE still fires the event + if ((e.delegateTarget.tagName === 'INPUT' || e.delegateTarget.tagName === 'BUTTON') && e.delegateTarget.disabled) { + return } + + fn.call(el, e); + } }, capture); };