|
5 | 5 | //>>css.structure: ../css/structure/jquery.mobile.collapsible.css |
6 | 6 | //>>css.theme: ../css/themes/default/jquery.mobile.theme.css |
7 | 7 |
|
8 | | -define( [ "jquery", "../jquery.mobile.widget", "./collapsible", "./addFirstLastClasses", "../jquery.mobile.registry" ], function( jQuery ) { |
| 8 | +define( [ |
| 9 | + "jquery", |
| 10 | + "../jquery.mobile.widget", |
| 11 | + "./collapsible", |
| 12 | + "./addFirstLastClasses", |
| 13 | + "../jquery.mobile.registry" ], function( jQuery ) { |
9 | 14 | //>>excludeEnd("jqmBuildExclude"); |
10 | 15 | (function( $, undefined ) { |
11 | 16 |
|
| 17 | +var childCollapsiblesSelector = ":mobile-collapsible, :jqmData(role='collapsible')"; |
| 18 | + |
12 | 19 | $.widget( "mobile.collapsibleset", $.extend( { |
| 20 | + options: $.extend( {}, $.mobile.collapsible.defaults ), |
| 21 | + |
13 | 22 | _create: function() { |
14 | 23 | var $el = this.element, |
15 | 24 | o = this.options, |
@@ -59,18 +68,24 @@ $.widget( "mobile.collapsibleset", $.extend( { |
59 | 68 | }, |
60 | 69 |
|
61 | 70 | _init: function() { |
62 | | - var $el = this.element, |
63 | | - collapsiblesInSet = $el.children( ":mobile-collapsible, :jqmData(role='collapsible')" ), |
64 | | - expanded = collapsiblesInSet.filter( ":jqmData(collapsed='false')" ); |
65 | 71 | this._refresh( "true" ); |
66 | 72 |
|
67 | 73 | // Because the corners are handled by the collapsible itself and the default state is collapsed |
68 | 74 | // That was causing https://github.com/jquery/jquery-mobile/issues/4116 |
69 | | - expanded.trigger( "expand" ); |
| 75 | + this.element |
| 76 | + .children( childCollapsiblesSelector ) |
| 77 | + .filter( ":jqmData(collapsed='false')" ) |
| 78 | + .trigger( "expand" ); |
| 79 | + }, |
| 80 | + |
| 81 | + _setOptions: function( options ) { |
| 82 | + var ret = this._super( options ); |
| 83 | + this.element.children( ":mobile-collapsible" ).collapsible( "refresh" ); |
| 84 | + return ret; |
70 | 85 | }, |
71 | 86 |
|
72 | 87 | _refresh: function( create ) { |
73 | | - var collapsiblesInSet = this.element.children( ":mobile-collapsible, :jqmData(role='collapsible')" ); |
| 88 | + var collapsiblesInSet = this.element.children( childCollapsiblesSelector ); |
74 | 89 |
|
75 | 90 | $.mobile.collapsible.prototype.enhance( collapsiblesInSet.not( ".ui-collapsible" ) ); |
76 | 91 |
|
|
0 commit comments