@@ -28,7 +28,7 @@ class Pattern extends BasePattern {
2828 _setupStack ( ) {
2929 let selected = this . _currentFragment ( ) ;
3030 const $sheets = this . $el . find ( this . options . selector ) ;
31- let $visible = [ ] ;
31+ this . $active = [ ] ;
3232
3333 if ( $sheets . length < 2 ) {
3434 log . warn ( "Stacks pattern: must have more than one sheet." , this . $el [ 0 ] ) ;
@@ -37,18 +37,18 @@ class Pattern extends BasePattern {
3737
3838 if ( selected ) {
3939 try {
40- $visible = $sheets . filter ( "#" + selected ) ;
40+ this . $active = $sheets . filter ( "#" + selected ) ;
4141 } catch ( e ) {
4242 selected = undefined ;
4343 }
4444 }
4545
46- if ( ! $visible . length ) {
47- $visible = $sheets . first ( ) ;
48- selected = $visible [ 0 ] . id ;
46+ if ( ! this . $active . length ) {
47+ this . $active = $sheets . first ( ) ;
48+ selected = this . $active [ 0 ] . id ;
4949 }
50- const $invisible = $sheets . not ( $visible ) ;
51- utils . hideOrShow ( $visible , true , { transition : "none" } , this . name ) ;
50+ const $invisible = $sheets . not ( this . $active ) ;
51+ utils . hideOrShow ( this . $active , true , { transition : "none" } , this . name ) ;
5252 utils . hideOrShow ( $invisible , false , { transition : "none" } , this . name ) ;
5353 this . _updateAnchors ( selected ) ;
5454 }
@@ -80,6 +80,8 @@ class Pattern extends BasePattern {
8080 this . _switch ( href_parts [ 1 ] ) ;
8181 $ ( e . target ) . trigger ( "pat-update" , {
8282 pattern : "stacks" ,
83+ action : "attribute-changed" ,
84+ dom : this . $active [ 0 ] ,
8385 originalEvent : e ,
8486 } ) ;
8587 }
@@ -104,13 +106,13 @@ class Pattern extends BasePattern {
104106 }
105107
106108 _switch ( sheet_id ) {
107- const $sheet = this . $el . find ( "#" + sheet_id ) ;
108- if ( ! $sheet . length || $sheet . hasClass ( "visible" ) ) {
109+ this . $active = this . $el . find ( "#" + sheet_id ) ;
110+ if ( ! this . $active . length || this . $active . hasClass ( "visible" ) ) {
109111 return ;
110112 }
111- const $invisible = this . $el . find ( this . options . selector ) . not ( $sheet ) ;
113+ const $invisible = this . $el . find ( this . options . selector ) . not ( this . $active ) ;
112114 utils . hideOrShow ( $invisible , false , this . options , this . name ) ;
113- utils . hideOrShow ( $sheet , true , this . options , this . name ) ;
115+ utils . hideOrShow ( this . $active , true , this . options , this . name ) ;
114116 }
115117}
116118
0 commit comments