Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

little performance improvement for getInheritedTheme

  • Loading branch information...
commit 406b3d43497a72b8a74c79cb64bf633cc0e8b4c6 1 parent d9f8ec0
Hans-Peter Buniat hpbuniat authored johnbender committed
Showing with 7 additions and 8 deletions.
  1. +7 −8 js/jquery.mobile.core.js
15 js/jquery.mobile.core.js 100644 → 100755
View
@@ -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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.