diff --git a/js/jquery.mobile.collapsible.js b/js/jquery.mobile.collapsible.js index f2eb368a..bdf7b48d 100644 --- a/js/jquery.mobile.collapsible.js +++ b/js/jquery.mobile.collapsible.js @@ -11,7 +11,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, { expandCueText: " click to expand contents", collapseCueText: " click to collapse contents", collapsed: true, - heading: ">:header,>legend", + heading: "h1,h2,h3,h4,h5,h6,legend", theme: null, contentTheme: null, iconTheme: "d", @@ -22,7 +22,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, { var $el = this.element, o = this.options, collapsible = $el.addClass( "ui-collapsible" ), - collapsibleHeading = $el.find( o.heading ).eq( 0 ), + collapsibleHeading = $el.children( o.heading ).first(), collapsibleContent = collapsible.wrapInner( "
" ).find( ".ui-collapsible-content" ), collapsibleSet = $el.closest( ":jqmData(role='collapsible-set')" ).addClass( "ui-collapsible-set" ), colllapsiblesInSet = collapsibleSet.children( ":jqmData(role='collapsible')" ); @@ -54,7 +54,8 @@ $.widget( "mobile.collapsible", $.mobile.widget, { .addClass( "ui-collapsible-heading" ) .append( "" ) .wrapInner( "" ) - .find( "a:eq(0)" ) + .find( "a" ) + .first() .buttonMarkup({ shadow: false, corners: false, @@ -65,7 +66,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, { if ( !collapsibleSet.length ) { collapsibleHeading - .find( "a:eq(0), .ui-btn-inner" ) + .find( "a" ).first().add( collapsibleHeading.find( ".ui-btn-inner" ) ) .addClass( "ui-corner-top ui-corner-bottom" ); } else { // If we are in a collapsible set @@ -86,14 +87,16 @@ $.widget( "mobile.collapsible", $.mobile.widget, { } colllapsiblesInSet.first() - .find( "a:eq(0)" ) + .find( "a" ) + .first() .addClass( "ui-corner-top" ) .find( ".ui-btn-inner" ) .addClass( "ui-corner-top" ); colllapsiblesInSet.last() .jqmData( "collapsible-last", true ) - .find( "a:eq(0)" ) + .find( "a" ) + .first() .addClass( "ui-corner-bottom" ) .find( ".ui-btn-inner" ) .addClass( "ui-corner-bottom" ); @@ -101,7 +104,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, { if ( collapsible.jqmData( "collapsible-last" ) ) { collapsibleHeading - .find( "a:eq(0), .ui-btn-inner" ) + .find( "a" ).first().add ( collapsibleHeading.find( ".ui-btn-inner" ) ) .addClass( "ui-corner-bottom" ); } } @@ -131,7 +134,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, { if ( contentTheme && ( !collapsibleSet.length || collapsible.jqmData( "collapsible-last" ) ) ) { collapsibleHeading - .find( "a:eq(0), .ui-btn-inner" ) + .find( "a" ).first().add( collapsibleHeading.find( ".ui-btn-inner" ) ) .toggleClass( "ui-corner-bottom", isCollapse ); collapsibleContent.toggleClass( "ui-corner-bottom", !isCollapse ); }