File tree 5 files changed +9
-6
lines changed
5 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 18
18
} ;
19
19
20
20
// polyfill for DOMTokenList features: list of classes in add/remove;
21
- // enable method.
21
+ // toggle method.
22
22
( function ( ) {
23
23
'use strict' ;
24
24
var add = DOMTokenList . prototype . add ;
33
33
remove . call ( this , arguments [ i ] ) ;
34
34
}
35
35
} ;
36
- DOMTokenList . prototype . enable = function ( name , value ) {
36
+ DOMTokenList . prototype . toggle = function ( name , value ) {
37
+ if ( value == undefined ) {
38
+ value = ! this . contains ( name ) ;
39
+ }
37
40
value ? this . add ( name ) : this . remove ( name ) ;
38
41
} ;
39
42
} ) ( ) ;
Original file line number Diff line number Diff line change 19
19
this . $ . icon . src = this . src ;
20
20
} ,
21
21
activeChanged : function ( ) {
22
- this . classList . enable ( 'selected' , this . active ) ;
22
+ this . classList . toggle ( 'selected' , this . active ) ;
23
23
}
24
24
}
25
25
} ) ;
Original file line number Diff line number Diff line change 26
26
prototype : {
27
27
valueAttributeChanged : function ( ) {
28
28
for ( var i = 0 , s ; s = this . stars [ i ] ; i ++ ) {
29
- s . classList . enable ( 'full' , i < Number ( this . value ) ) ;
29
+ s . classList . toggle ( 'full' , i < Number ( this . value ) ) ;
30
30
}
31
31
} ,
32
32
clickHandler : function ( e ) {
Original file line number Diff line number Diff line change 17
17
this . component ( {
18
18
prototype : {
19
19
verticalChanged : function ( ) {
20
- this . classList . enable ( 'vertical' , this . vertical ) ;
20
+ this . classList . toggle ( 'vertical' , this . vertical ) ;
21
21
}
22
22
}
23
23
} ) ;
Original file line number Diff line number Diff line change 19
19
this . component ( {
20
20
prototype : {
21
21
valueChanged : function ( ) {
22
- this . $ . toggle . classList . enable ( 'on' , this . value ) ;
22
+ this . $ . toggle . classList . toggle ( 'on' , this . value ) ;
23
23
} ,
24
24
toggle : function ( ) {
25
25
this . value = ! this . value ;
You can’t perform that action at this time.
0 commit comments