diff --git a/lib/fastclick.js b/lib/fastclick.js index 86bf83e0..972c232e 100644 --- a/lib/fastclick.js +++ b/lib/fastclick.js @@ -22,6 +22,7 @@ */ function FastClick(layer, options) { var oldOnClick; + var oldOnClickNoop = function () {}; options = options || {}; @@ -167,9 +168,11 @@ // - the old one won't work if passed to addEventListener directly. oldOnClick = layer.onclick; layer.addEventListener('click', function(event) { - oldOnClick(event); + if (layer.onclick === oldOnClickNoop) { + oldOnClick(event); + } }, false); - layer.onclick = null; + layer.onclick = oldOnClickNoop; } }