Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
little performance improvement for getInheritedTheme
Browse files Browse the repository at this point in the history
  • Loading branch information
hpbuniat authored and johnbender committed Jun 1, 2012
1 parent d9f8ec0 commit 406b3d4
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions js/jquery.mobile.core.js 100644 → 100755
Expand Up @@ -160,25 +160,24 @@ define( [ "jquery", "../external/requirejs/text!../version.txt", "./jquery.mobil
return nsNormalizeDict[ prop ] || ( nsNormalizeDict[ prop ] = $.camelCase( $.mobile.ns + prop ) );
},

// Find the closest parent with a theme class on it. Note that
// we are not using $.fn.closest() on purpose here because this
// method gets called quite a bit and we need it to be as fast
// as possible.
getInheritedTheme: function( el, defaultTheme ) {

// Find the closest parent with a theme class on it. Note that
// we are not using $.fn.closest() on purpose here because this
// method gets called quite a bit and we need it to be as fast
// as possible.

var e = el[ 0 ],
ltr = "",
re = /ui-(bar|body|overlay)-([a-z])\b/,
c, m;
m;

while ( e ) {
var c = e.className || "";
if ( ( m = re.exec( c ) ) && ( ltr = m[ 2 ] ) ) {
if ( c && ( m = re.exec( c ) ) && ( ltr = m[ 2 ] ) ) {
// We found a parent with a theme class
// on it so bail from this loop.
break;
}

e = e.parentNode;
}

Expand Down

0 comments on commit 406b3d4

Please sign in to comment.