File tree Expand file tree Collapse file tree 5 files changed +25
-10
lines changed Expand file tree Collapse file tree 5 files changed +25
-10
lines changed Original file line number Diff line number Diff line change 125
125
126
126
createStylesheet : function ( id ) {
127
127
var stylesheet = new CSSStyleSheet ( ) ;
128
-
128
+ stylesheet . _id = id ;
129
129
if ( ! document . adoptedStyleSheets || document . adoptedStyleSheets . length === 0 ) {
130
130
document . adoptedStyleSheets = [ stylesheet ] ;
131
131
} else {
139
139
return stylesheet ;
140
140
} ,
141
141
142
- removeStylesheet : function ( stylesheet ) {
142
+ removeStylesheet : function ( stylesId ) {
143
143
var styles = [ ] ;
144
144
document . adoptedStyleSheets . forEach ( function ( style ) {
145
145
styles . push ( style ) ;
146
146
} ) ;
147
- styles . splice ( styles . indexOf ( stylesheet ) , 1 ) ;
147
+ var indexToRemove = styles . findIndex ( function ( style ) {
148
+ return style . _id === stylesId ;
149
+ } ) ;
150
+ if ( indexToRemove < 0 ) {
151
+ return ;
152
+ }
153
+ styles . splice ( indexToRemove , 1 ) ;
148
154
document . adoptedStyleSheets = styles ;
149
155
} ,
150
156
1435
1441
}
1436
1442
if ( Utils . isConstructableStyleSheetSupported ( ) ) {
1437
1443
Utils . removeStylesheet ( this . _stylesId ) ;
1444
+ this . styles = null ;
1438
1445
}
1439
1446
if ( this . grid ) {
1440
1447
this . grid = null ;
You can’t perform that action at this time.
0 commit comments