mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-19 20:01:52 +00:00
Got rid of pseudo selectors :header and :eq(0) since they take a long time on WP7.5 (Mango). This shaves off 300 msecs when loading the form gallery page.
This commit is contained in:
parent
8fb55a8afa
commit
8e23813d25
1 changed files with 11 additions and 8 deletions
|
|
@ -11,7 +11,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
|
||||||
expandCueText: " click to expand contents",
|
expandCueText: " click to expand contents",
|
||||||
collapseCueText: " click to collapse contents",
|
collapseCueText: " click to collapse contents",
|
||||||
collapsed: true,
|
collapsed: true,
|
||||||
heading: ">:header,>legend",
|
heading: "h1,h2,h3,h4,h5,h6,legend",
|
||||||
theme: null,
|
theme: null,
|
||||||
contentTheme: null,
|
contentTheme: null,
|
||||||
iconTheme: "d",
|
iconTheme: "d",
|
||||||
|
|
@ -22,7 +22,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
|
||||||
var $el = this.element,
|
var $el = this.element,
|
||||||
o = this.options,
|
o = this.options,
|
||||||
collapsible = $el.addClass( "ui-collapsible" ),
|
collapsible = $el.addClass( "ui-collapsible" ),
|
||||||
collapsibleHeading = $el.find( o.heading ).eq( 0 ),
|
collapsibleHeading = $el.children( o.heading ).first(),
|
||||||
collapsibleContent = collapsible.wrapInner( "<div class='ui-collapsible-content'></div>" ).find( ".ui-collapsible-content" ),
|
collapsibleContent = collapsible.wrapInner( "<div class='ui-collapsible-content'></div>" ).find( ".ui-collapsible-content" ),
|
||||||
collapsibleSet = $el.closest( ":jqmData(role='collapsible-set')" ).addClass( "ui-collapsible-set" ),
|
collapsibleSet = $el.closest( ":jqmData(role='collapsible-set')" ).addClass( "ui-collapsible-set" ),
|
||||||
colllapsiblesInSet = collapsibleSet.children( ":jqmData(role='collapsible')" );
|
colllapsiblesInSet = collapsibleSet.children( ":jqmData(role='collapsible')" );
|
||||||
|
|
@ -54,7 +54,8 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
|
||||||
.addClass( "ui-collapsible-heading" )
|
.addClass( "ui-collapsible-heading" )
|
||||||
.append( "<span class='ui-collapsible-heading-status'></span>" )
|
.append( "<span class='ui-collapsible-heading-status'></span>" )
|
||||||
.wrapInner( "<a href='#' class='ui-collapsible-heading-toggle'></a>" )
|
.wrapInner( "<a href='#' class='ui-collapsible-heading-toggle'></a>" )
|
||||||
.find( "a:eq(0)" )
|
.find( "a" )
|
||||||
|
.first()
|
||||||
.buttonMarkup({
|
.buttonMarkup({
|
||||||
shadow: false,
|
shadow: false,
|
||||||
corners: false,
|
corners: false,
|
||||||
|
|
@ -65,7 +66,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
|
||||||
|
|
||||||
if ( !collapsibleSet.length ) {
|
if ( !collapsibleSet.length ) {
|
||||||
collapsibleHeading
|
collapsibleHeading
|
||||||
.find( "a:eq(0), .ui-btn-inner" )
|
.find( "a" ).first().add( collapsibleHeading.find( ".ui-btn-inner" ) )
|
||||||
.addClass( "ui-corner-top ui-corner-bottom" );
|
.addClass( "ui-corner-top ui-corner-bottom" );
|
||||||
} else {
|
} else {
|
||||||
// If we are in a collapsible set
|
// If we are in a collapsible set
|
||||||
|
|
@ -86,14 +87,16 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
|
||||||
}
|
}
|
||||||
|
|
||||||
colllapsiblesInSet.first()
|
colllapsiblesInSet.first()
|
||||||
.find( "a:eq(0)" )
|
.find( "a" )
|
||||||
|
.first()
|
||||||
.addClass( "ui-corner-top" )
|
.addClass( "ui-corner-top" )
|
||||||
.find( ".ui-btn-inner" )
|
.find( ".ui-btn-inner" )
|
||||||
.addClass( "ui-corner-top" );
|
.addClass( "ui-corner-top" );
|
||||||
|
|
||||||
colllapsiblesInSet.last()
|
colllapsiblesInSet.last()
|
||||||
.jqmData( "collapsible-last", true )
|
.jqmData( "collapsible-last", true )
|
||||||
.find( "a:eq(0)" )
|
.find( "a" )
|
||||||
|
.first()
|
||||||
.addClass( "ui-corner-bottom" )
|
.addClass( "ui-corner-bottom" )
|
||||||
.find( ".ui-btn-inner" )
|
.find( ".ui-btn-inner" )
|
||||||
.addClass( "ui-corner-bottom" );
|
.addClass( "ui-corner-bottom" );
|
||||||
|
|
@ -101,7 +104,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
|
||||||
|
|
||||||
if ( collapsible.jqmData( "collapsible-last" ) ) {
|
if ( collapsible.jqmData( "collapsible-last" ) ) {
|
||||||
collapsibleHeading
|
collapsibleHeading
|
||||||
.find( "a:eq(0), .ui-btn-inner" )
|
.find( "a" ).first().add ( collapsibleHeading.find( ".ui-btn-inner" ) )
|
||||||
.addClass( "ui-corner-bottom" );
|
.addClass( "ui-corner-bottom" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -131,7 +134,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
|
||||||
|
|
||||||
if ( contentTheme && ( !collapsibleSet.length || collapsible.jqmData( "collapsible-last" ) ) ) {
|
if ( contentTheme && ( !collapsibleSet.length || collapsible.jqmData( "collapsible-last" ) ) ) {
|
||||||
collapsibleHeading
|
collapsibleHeading
|
||||||
.find( "a:eq(0), .ui-btn-inner" )
|
.find( "a" ).first().add( collapsibleHeading.find( ".ui-btn-inner" ) )
|
||||||
.toggleClass( "ui-corner-bottom", isCollapse );
|
.toggleClass( "ui-corner-bottom", isCollapse );
|
||||||
collapsibleContent.toggleClass( "ui-corner-bottom", !isCollapse );
|
collapsibleContent.toggleClass( "ui-corner-bottom", !isCollapse );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue