Permalink
Browse files

Reclaim 250 msecs on iPad and WP7.5 (Mango) by simply combining find(…

…).filter() calls and getting rid of fake pseudo selectors :eq(0) and :last.
  • Loading branch information...
1 parent 7406ea2 commit 343161c9721e6dfb1d25f8278b95eaad0c857c72 @jblas jblas committed Nov 11, 2011
Showing with 4 additions and 4 deletions.
  1. +3 −3 js/jquery.mobile.controlGroup.js
  2. +1 −1 js/jquery.mobile.forms.checkboxradio.js
@@ -14,9 +14,9 @@ $.fn.controlgroup = function( options ) {
shadow: false,
excludeInvisible: true
}, options ),
- groupheading = $el.find( ">legend" ),
+ groupheading = $el.children( "legend" ),
flCorners = o.direction == "horizontal" ? [ "ui-corner-left", "ui-corner-right" ] : [ "ui-corner-top", "ui-corner-bottom" ],
- type = $el.find( "input:eq(0)" ).attr( "type" );
+ type = $el.find( "input" ).first().attr( "type" );
// Replace legend with more stylable replacement div
if ( groupheading.length ) {
@@ -33,7 +33,7 @@ $.fn.controlgroup = function( options ) {
els.removeClass( "ui-btn-corner-all ui-shadow" )
.eq( 0 ).addClass( flCorners[ 0 ] )
.end()
- .filter( ":last" ).addClass( flCorners[ 1 ] ).addClass( "ui-controlgroup-last" );
+ .last().addClass( flCorners[ 1 ] ).addClass( "ui-controlgroup-last" );
}
flipClasses( $el.find( ".ui-btn" + ( o.excludeInvisible ? ":visible" : "" ) ) );
@@ -14,7 +14,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
input = this.element,
// NOTE: Windows Phone could not find the label through a selector
// filter works though.
- label = input.closest( "form,fieldset,:jqmData(role='page')" ).find( "label" ).filter( "[for='" + input[ 0 ].id + "']"),
+ label = input.closest( "form,fieldset,:jqmData(role='page')" ).find( "label[for='" + input[ 0 ].id + "']"),
inputtype = input.attr( "type" ),
checkedState = inputtype + "-on",
uncheckedState = inputtype + "-off",

0 comments on commit 343161c

Please sign in to comment.