From 85d840b7b0ca8bd536520c421971aa0948cd8aaa Mon Sep 17 00:00:00 2001 From: ronchalant Date: Thu, 20 Oct 2011 15:27:12 -0300 Subject: [PATCH 1/4] Update js/jquery.mobile.core.js --- js/jquery.mobile.core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/jquery.mobile.core.js b/js/jquery.mobile.core.js index 754950283cb..ad1f7453809 100644 --- a/js/jquery.mobile.core.js +++ b/js/jquery.mobile.core.js @@ -133,7 +133,7 @@ // If there's a themed parent, extract the theme letter // from the theme class . - ltr = ( themedParent.length && /ui-(bar|body)-([a-z])\b/.exec( themedParent.attr( "class" ) )[ 2 ] || "" ) || ""; + ltr = ( themedParent.length && (ltr = /ui-(bar|body)-([a-z])\b/.exec( themedParent.attr( "class" ) )) && ltr[ 2 ] || "" ) || ""; // Return the theme letter we found, if none, return the // specified default. From 292c7b2d26fc461c03dba525a7b42fe4da832762 Mon Sep 17 00:00:00 2001 From: ronchalant Date: Thu, 20 Oct 2011 17:40:25 -0300 Subject: [PATCH 2/4] Update js/jquery.mobile.core.js --- js/jquery.mobile.core.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/js/jquery.mobile.core.js b/js/jquery.mobile.core.js index ad1f7453809..bcd65740f7c 100644 --- a/js/jquery.mobile.core.js +++ b/js/jquery.mobile.core.js @@ -128,17 +128,7 @@ }, getInheritedTheme: function( el, defaultTheme ) { - // Find the closest parent with a theme class on it. - var themedParent = el.closest( "[class*='ui-bar-'],[class*='ui-body-']" ), - - // If there's a themed parent, extract the theme letter - // from the theme class . - ltr = ( themedParent.length && (ltr = /ui-(bar|body)-([a-z])\b/.exec( themedParent.attr( "class" ) )) && ltr[ 2 ] || "" ) || ""; - - // Return the theme letter we found, if none, return the - // specified default. - - return ltr || defaultTheme || "a"; + return $( el ).inheritedTheme( defaultTheme ); } }); @@ -167,6 +157,15 @@ $.jqmRemoveData = function( elem, prop ) { return $.removeData( elem, $.mobile.nsNormalize( prop ) ); }; + + $.fn.inheritedTheme = function( defaultTheme ) { + // Find the closest parent with a theme class on it. + var p = this.parent(), + cl = p.attr( "class" ), + ltr = (cl && ( ltr = /ui-(bar|body)-([a-z])\b/.exec( cl ) ) && ltr[ 2 ]) || ""; + + return ltr || ( p.parent() && p.inheritedTheme( defaultTheme ) ) || defaultTheme || "a"; + }; $.fn.removeWithDependents = function() { $.removeWithDependents( this ); From 999b86b08c5422249c2ca5284e20597f7b5fabc7 Mon Sep 17 00:00:00 2001 From: ronchalant Date: Thu, 20 Oct 2011 19:23:52 -0300 Subject: [PATCH 3/4] Update js/jquery.mobile.core.js --- js/jquery.mobile.core.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/jquery.mobile.core.js b/js/jquery.mobile.core.js index bcd65740f7c..af078ba3222 100644 --- a/js/jquery.mobile.core.js +++ b/js/jquery.mobile.core.js @@ -159,12 +159,12 @@ }; $.fn.inheritedTheme = function( defaultTheme ) { - // Find the closest parent with a theme class on it. - var p = this.parent(), - cl = p.attr( "class" ), - ltr = (cl && ( ltr = /ui-(bar|body)-([a-z])\b/.exec( cl ) ) && ltr[ 2 ]) || ""; - - return ltr || ( p.parent() && p.inheritedTheme( defaultTheme ) ) || defaultTheme || "a"; + var ltr; + this.parents("[class*='ui-bar-'],[class*='ui-body-']").each(function() { + ltr = ( ( ltr = /ui-(bar|body)-([a-z])\b/.exec( $(this).attr("class") ) ) && ltr[ 2 ]) || ""; + if (ltr) return false; + }); + return ltr || "a"; }; $.fn.removeWithDependents = function() { From 78c3090637fab35cbb9e6b2d627aa4ad07fce851 Mon Sep 17 00:00:00 2001 From: ronchalant Date: Thu, 20 Oct 2011 19:45:41 -0300 Subject: [PATCH 4/4] Update js/jquery.mobile.core.js --- js/jquery.mobile.core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/jquery.mobile.core.js b/js/jquery.mobile.core.js index af078ba3222..ece5a998597 100644 --- a/js/jquery.mobile.core.js +++ b/js/jquery.mobile.core.js @@ -164,7 +164,7 @@ ltr = ( ( ltr = /ui-(bar|body)-([a-z])\b/.exec( $(this).attr("class") ) ) && ltr[ 2 ]) || ""; if (ltr) return false; }); - return ltr || "a"; + return ltr || defaultTheme || "a"; }; $.fn.removeWithDependents = function() {