From 29c0471cca60963e905f4a03ab689a5395ae3541 Mon Sep 17 00:00:00 2001 From: jeresig Date: Tue, 22 Mar 2011 14:35:11 -0400 Subject: [PATCH] Make sure that the :jqdata() selector also works for filtered items. --- js/jquery.mobile.core.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/jquery.mobile.core.js b/js/jquery.mobile.core.js index 757f6485..c4171d99 100644 --- a/js/jquery.mobile.core.js +++ b/js/jquery.mobile.core.js @@ -151,11 +151,19 @@ // Monkey-patching Sizzle to filter the :jqdata selector var oldFind = jQuery.find; - jQuery.find = function( selector, context, ret ) { + jQuery.find = function( selector, context, ret, extra ) { selector = selector.replace(/:jqdata\(([^)]*)\)/g, "[data-" + (jQuery.mobile.ns || "") + "$1]"); - return oldFind.call( this, selector, context, ret ); + return oldFind.call( this, selector, context, ret, extra ); }; jQuery.extend( jQuery.find, oldFind ); + + jQuery.find.matches = function( expr, set ) { + return jQuery.find( expr, null, null, set ); + }; + + jQuery.find.matchesSelector = function( node, expr ) { + return jQuery.find( expr, null, null, [node] ).length > 0; + }; })( jQuery, this );