Skip to content

Commit 343161c

Browse files
committed
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.
1 parent 7406ea2 commit 343161c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

js/jquery.mobile.controlGroup.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ $.fn.controlgroup = function( options ) {
1414
shadow: false,
1515
excludeInvisible: true
1616
}, options ),
17-
groupheading = $el.find( ">legend" ),
17+
groupheading = $el.children( "legend" ),
1818
flCorners = o.direction == "horizontal" ? [ "ui-corner-left", "ui-corner-right" ] : [ "ui-corner-top", "ui-corner-bottom" ],
19-
type = $el.find( "input:eq(0)" ).attr( "type" );
19+
type = $el.find( "input" ).first().attr( "type" );
2020

2121
// Replace legend with more stylable replacement div
2222
if ( groupheading.length ) {
@@ -33,7 +33,7 @@ $.fn.controlgroup = function( options ) {
3333
els.removeClass( "ui-btn-corner-all ui-shadow" )
3434
.eq( 0 ).addClass( flCorners[ 0 ] )
3535
.end()
36-
.filter( ":last" ).addClass( flCorners[ 1 ] ).addClass( "ui-controlgroup-last" );
36+
.last().addClass( flCorners[ 1 ] ).addClass( "ui-controlgroup-last" );
3737
}
3838

3939
flipClasses( $el.find( ".ui-btn" + ( o.excludeInvisible ? ":visible" : "" ) ) );

js/jquery.mobile.forms.checkboxradio.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
1414
input = this.element,
1515
// NOTE: Windows Phone could not find the label through a selector
1616
// filter works though.
17-
label = input.closest( "form,fieldset,:jqmData(role='page')" ).find( "label" ).filter( "[for='" + input[ 0 ].id + "']"),
17+
label = input.closest( "form,fieldset,:jqmData(role='page')" ).find( "label[for='" + input[ 0 ].id + "']"),
1818
inputtype = input.attr( "type" ),
1919
checkedState = inputtype + "-on",
2020
uncheckedState = inputtype + "-off",

0 commit comments

Comments
 (0)