Permalink
Browse files

Collapsibleset: remove deprecated collapsible-set name

  • Loading branch information...
arschmitz committed May 6, 2015
1 parent 7a905f6 commit bfd528c13a34b8fa9d7bebdf3a893a8722383037
Showing with 19 additions and 23 deletions.
  1. +9 −13 js/widgets/collapsibleSet.js
  2. +10 −10 tests/integration/collapsible/index.html
@@ -31,24 +31,17 @@
}
} )( function( $ ) {
var childCollapsiblesSelector = ":mobile-collapsible, " + $.mobile.collapsible.initSelector;
return $.widget( "mobile.collapsibleset", $.extend( {
version: "@VERSION",
// The initSelector is deprecated as of 1.4.0. In 1.5.0 we will use
// :jqmData(role='collapsibleset') which will allow us to get rid of the line
// below altogether, because the autoinit will generate such an initSelector
initSelector: ":jqmData(role='collapsible-set'),:jqmData(role='collapsibleset')",
options: $.extend( {
enhanced: false
}, $.mobile.collapsible.defaults ),
_handleCollapsibleExpand: function( event ) {
var closestCollapsible = $( event.target ).closest( ".ui-collapsible" );
if ( closestCollapsible.parent().is( ":mobile-collapsibleset, :jqmData(role='collapsible-set')" ) ) {
if ( closestCollapsible.parent().is( ":mobile-collapsibleset, :jqmData(role='collapsibleset')" ) ) {
closestCollapsible
.siblings( ".ui-collapsible:not(.ui-collapsible-collapsed)" )
.collapsible( "collapse" );
@@ -63,11 +56,14 @@ return $.widget( "mobile.collapsibleset", $.extend( {
_classes: ""
} );
this.childCollapsiblesSelector = ":mobile-collapsible, " +
( "[data-" + $.mobile.ns + "role='collapsible']" );
if ( !opts.enhanced ) {
elem.addClass( "ui-collapsible-set " +
this._themeClassFromOption( "ui-group-theme-", opts.theme ) + " " +
( opts.corners && opts.inset ? "ui-corner-all " : "" ) );
this.element.find( $.mobile.collapsible.initSelector ).collapsible();
this.element.find( this.childCollapsiblesSelector ).collapsible();
}
this._on( elem, { collapsibleexpand: "_handleCollapsibleExpand" } );
@@ -83,7 +79,7 @@ return $.widget( "mobile.collapsibleset", $.extend( {
// Because the corners are handled by the collapsible itself and the default state is collapsed
// That was causing https://github.com/jquery/jquery-mobile/issues/4116
this.element
.children( childCollapsiblesSelector )
.children( this.childCollapsiblesSelector )
.filter( ":jqmData(collapsed='false')" )
.collapsible( "expand" );
},
@@ -119,7 +115,7 @@ return $.widget( "mobile.collapsibleset", $.extend( {
_destroy: function() {
var el = this.element;
this._removeFirstLastClasses( el.children( childCollapsiblesSelector ) );
this._removeFirstLastClasses( el.children( this.childCollapsiblesSelector ) );
el
.removeClass( "ui-collapsible-set ui-corner-all " +
this._themeClassFromOption( "ui-group-theme-", this.options.theme ) )
@@ -128,9 +124,9 @@ return $.widget( "mobile.collapsibleset", $.extend( {
},
_refresh: function( create ) {
var collapsiblesInSet = this.element.children( childCollapsiblesSelector );
var collapsiblesInSet = this.element.children( this.childCollapsiblesSelector );
this.element.find( $.mobile.collapsible.initSelector ).not( ".ui-collapsible" ).collapsible();
this.element.find( this.childCollapsiblesSelector ).not( ".ui-collapsible" ).collapsible();
this._addFirstLastClasses( collapsiblesInSet, this._getVisibles( collapsiblesInSet, create ), create );
},
@@ -75,7 +75,7 @@ <h4 class="ui-collapsible-heading ui-collapsible-heading-collapsed">
</div>
</div>
<div id="basic-collapsible-set" data-nstest-role="collapsible-set">
<div id="basic-collapsible-set" data-nstest-role="collapsibleset">
<div data-nstest-role="collapsible">
<h3>Section A</h3>
@@ -98,7 +98,7 @@ <h3>Section C</h3>
</div>
</div>
<div id="collapsible-options-test" data-nstest-role="collapsible-set">
<div id="collapsible-options-test" data-nstest-role="collapsibleset">
<div data-nstest-role="collapsible">
<h3>Section A</h3>
@@ -121,7 +121,7 @@ <h3>Section C</h3>
</div>
</div>
<div id="only-one-collapsible" data-nstest-role="collapsible-set">
<div id="only-one-collapsible" data-nstest-role="collapsibleset">
<div data-nstest-role="collapsible" >
<h3>Section D</h3>
@@ -136,16 +136,16 @@ <h3>Section E</h3>
<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I
have the "collapsed" state; you need to expand the header to see me.</p>
</div>
<div id="dynamic-content" data-nstest-role="collapsible-set"></div>
<div id="static-and-dynamic" data-nstest-role="collapsible-set">
<div id="dynamic-content" data-nstest-role="collapsibleset"></div>
<div id="static-and-dynamic" data-nstest-role="collapsibleset">
<div data-nstest-role="collapsible">
<h3>Section A</h3>
<p>I'm the collapsible content in a set so this feels like an accordion. I'm hidden by default because I
have the "collapsed" state; you need to expand the header to see me.</p>
</div>
</div>
<div id="last-collapsible-expanded" data-nstest-role="collapsible-set">
<div id="last-collapsible-expanded" data-nstest-role="collapsibleset">
<div data-nstest-role="collapsible">
<h1>Collapsible collapsed</h1>
<ul data-nstest-role="listview" data-inset="true">
@@ -161,7 +161,7 @@ <h1>Collapsible initial uncollapsed</h1>
</ul>
</div>
</div>
<form id="legend-based" data-nstest-role="collapsible-set">
<form id="legend-based" data-nstest-role="collapsibleset">
<fieldset data-nstest-role="collapsible">
<legend>Legend</legend>
<div data-nstest-role="controlgroup">
@@ -218,7 +218,7 @@ <h3>Section E</h3>
</div>
</div>
<div id="collapsible-set-with-custom-icons">
<div data-nstest-role="collapsible-set">
<div data-nstest-role="collapsibleset">
<div data-nstest-role="collapsible">
<h3>Section A</h3>
@@ -232,7 +232,7 @@ <h3>Section B</h3>
have the "collapsed" state; you need to expand the header to see me.</p>
</div>
</div>
<div data-nstest-role="collapsible-set" data-nstest-collapsed-icon="arrow-r" data-nstest-expanded-icon="arrow-d">
<div data-nstest-role="collapsibleset" data-nstest-collapsed-icon="arrow-r" data-nstest-expanded-icon="arrow-d">
<div data-nstest-role="collapsible">
<h3>Section A</h3>
@@ -279,7 +279,7 @@ <h3>Section B</h3>
have the "collapsed" state; you need to expand the header to see me.</p>
</div>
</div>
<div id="collapsible-set-with-theming" data-nstest-role="collapsible-set" data-nstest-theme="b" data-nstest-content-theme="d">
<div id="collapsible-set-with-theming" data-nstest-role="collapsibleset" data-nstest-theme="b" data-nstest-content-theme="d">
<div data-nstest-role="collapsible" data-nstest-theme="a">
<h3>Section A</h3>

0 comments on commit bfd528c

Please sign in to comment.