From 3dd5ea454284d7a4a2ec7260c701a55eb11ec4fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Mart=C3=ADnez?= Date: Fri, 2 Jun 2017 08:08:52 -0500 Subject: [PATCH] Fixbug : fix conflict with Mootols and Jquery Was validated the exist of the function removeEvent --- sorttable.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/sorttable.js b/sorttable.js index f571270..6bc3a9a 100644 --- a/sorttable.js +++ b/sorttable.js @@ -405,15 +405,18 @@ function dean_addEvent(element, type, handler) { // a counter used to create unique IDs dean_addEvent.guid = 1; -function removeEvent(element, type, handler) { - if (element.removeEventListener) { - element.removeEventListener(type, handler, false); - } else { - // delete the event handler from the hash table - if (element.events && element.events[type]) { - delete element.events[type][handler.$$guid]; - } - } +if( typeof removeEvent !== 'function') +{ + var removeEvent = function (element, type, handler) { + if (element.removeEventListener) { + element.removeEventListener(type, handler, false); + } else { + // delete the event handler from the hash table + if (element.events && element.events[type]) { + delete element.events[type][handler.$$guid]; + } + } + } } function handleEvent(event) { @@ -498,4 +501,3 @@ var forEach = function(object, block, context) { resolve.forEach(object, block, context); } }; -