File tree Expand file tree Collapse file tree 1 file changed +1
-5
lines changed Expand file tree Collapse file tree 1 file changed +1
-5
lines changed Original file line number Diff line number Diff line change @@ -132,11 +132,9 @@ export class BaseLayerElement extends HTMLElement {
132
132
}
133
133
_registerMediaQuery ( mq ) {
134
134
if ( ! this . _changeHandler ) {
135
- // Define and bind the change handler once
136
135
this . _changeHandler = ( ) => {
137
136
this . _onRemove ( ) ;
138
137
if ( this . _mql . matches ) {
139
- // TODO evaluate if _onAdd does the right thing for this situation
140
138
this . _onAdd ( ) ;
141
139
}
142
140
// set the disabled 'read-only' attribute indirectly, via _validateDisabled
@@ -154,13 +152,11 @@ export class BaseLayerElement extends HTMLElement {
154
152
this . _mql . removeEventListener ( 'change' , this . _changeHandler ) ;
155
153
}
156
154
157
- // Set up the new media query and listener
158
155
this . _mql = map . matchMedia ( mq ) ;
159
- this . _changeHandler ( ) ; // Initial evaluation
156
+ this . _changeHandler ( ) ;
160
157
this . _mql . addEventListener ( 'change' , this . _changeHandler ) ;
161
158
} else if ( this . _mql ) {
162
159
// the media attribute removed or query set to ''
163
- // Clean up the existing listener
164
160
this . _mql . removeEventListener ( 'change' , this . _changeHandler ) ;
165
161
delete this . _mql ;
166
162
// effectively, no / empty media attribute matches, do what changeHandler does
You can’t perform that action at this time.
0 commit comments