From 677f6e8de5fde1ec844c075814dab8cc2db43859 Mon Sep 17 00:00:00 2001 From: Viktor Kojouharov Date: Tue, 21 Aug 2012 13:22:59 +0300 Subject: [PATCH] Update for new Sizzle and jQuery These changes make the plugin work with jQuery 1.8 with the new Sizzle filter declarations and internal event data structure. (At least for regular non-delegated events). It also still works with older jQuery versions (tested with 1.6.4) --- jquery.hasEventListener-2.0.4.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/jquery.hasEventListener-2.0.4.js b/jquery.hasEventListener-2.0.4.js index 7cc3d78..6508c36 100644 --- a/jquery.hasEventListener-2.0.4.js +++ b/jquery.hasEventListener-2.0.4.js @@ -110,8 +110,7 @@ } : function (element) { - return $[DATA](element, EVENTS); - + return $._data(element, EVENTS) || $[DATA](element, EVENTS); }; compatibility[LIVE] = !!jQuery_fn[LIVE]; // 1.3.0+ @@ -413,11 +412,19 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - $.expr[":"][PLUGIN_NAME] = function (dom_element, index, match) { + if ($.expr.createPseudo) { + $.expr[":"][PLUGIN_NAME] = $.expr.createPseudo(function (selector, context, xml) { + return function (elem) { + return $[PLUGIN_NAME](elem, selector); + } + }); + } else { + $.expr[":"][PLUGIN_NAME] = function (dom_element, index, match) { - return $[PLUGIN_NAME](dom_element, match[3]); + return $[PLUGIN_NAME](dom_element, match[3]); - }; + }; + } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *