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 {
132132 }
133133 _registerMediaQuery ( mq ) {
134134 if ( ! this . _changeHandler ) {
135- // Define and bind the change handler once
136135 this . _changeHandler = ( ) => {
137136 this . _onRemove ( ) ;
138137 if ( this . _mql . matches ) {
139- // TODO evaluate if _onAdd does the right thing for this situation
140138 this . _onAdd ( ) ;
141139 }
142140 // set the disabled 'read-only' attribute indirectly, via _validateDisabled
@@ -154,13 +152,11 @@ export class BaseLayerElement extends HTMLElement {
154152 this . _mql . removeEventListener ( 'change' , this . _changeHandler ) ;
155153 }
156154
157- // Set up the new media query and listener
158155 this . _mql = map . matchMedia ( mq ) ;
159- this . _changeHandler ( ) ; // Initial evaluation
156+ this . _changeHandler ( ) ;
160157 this . _mql . addEventListener ( 'change' , this . _changeHandler ) ;
161158 } else if ( this . _mql ) {
162159 // the media attribute removed or query set to ''
163- // Clean up the existing listener
164160 this . _mql . removeEventListener ( 'change' , this . _changeHandler ) ;
165161 delete this . _mql ;
166162 // effectively, no / empty media attribute matches, do what changeHandler does
You can’t perform that action at this time.
0 commit comments