@@ -28,7 +28,7 @@ class Pattern extends BasePattern {
28
28
_setupStack ( ) {
29
29
let selected = this . _currentFragment ( ) ;
30
30
const $sheets = this . $el . find ( this . options . selector ) ;
31
- let $visible = [ ] ;
31
+ this . $active = [ ] ;
32
32
33
33
if ( $sheets . length < 2 ) {
34
34
log . warn ( "Stacks pattern: must have more than one sheet." , this . $el [ 0 ] ) ;
@@ -37,18 +37,18 @@ class Pattern extends BasePattern {
37
37
38
38
if ( selected ) {
39
39
try {
40
- $visible = $sheets . filter ( "#" + selected ) ;
40
+ this . $active = $sheets . filter ( "#" + selected ) ;
41
41
} catch ( e ) {
42
42
selected = undefined ;
43
43
}
44
44
}
45
45
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 ;
49
49
}
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 ) ;
52
52
utils . hideOrShow ( $invisible , false , { transition : "none" } , this . name ) ;
53
53
this . _updateAnchors ( selected ) ;
54
54
}
@@ -80,6 +80,8 @@ class Pattern extends BasePattern {
80
80
this . _switch ( href_parts [ 1 ] ) ;
81
81
$ ( e . target ) . trigger ( "pat-update" , {
82
82
pattern : "stacks" ,
83
+ action : "attribute-changed" ,
84
+ dom : this . $active [ 0 ] ,
83
85
originalEvent : e ,
84
86
} ) ;
85
87
}
@@ -104,13 +106,13 @@ class Pattern extends BasePattern {
104
106
}
105
107
106
108
_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" ) ) {
109
111
return ;
110
112
}
111
- const $invisible = this . $el . find ( this . options . selector ) . not ( $sheet ) ;
113
+ const $invisible = this . $el . find ( this . options . selector ) . not ( this . $active ) ;
112
114
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 ) ;
114
116
}
115
117
}
116
118
0 commit comments