File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ export type RangeDirection = 'at' | 'from' | 'to';
2323interface ResizeObserverService {
2424 observe ( element : HTMLElement , callback ?: ( ) => void ) : void ;
2525 unobserve ( element : HTMLElement , callback ?: ( ) => void ) : void ;
26+ isEnabled : boolean ;
2627}
2728
2829/** @internal */
@@ -555,8 +556,8 @@ export default class ElementQueryModifier extends Modifier<ModifierArgs> {
555556 if ( ! this . args . named . isDisabled && ! this . isDestroying && ! this . isDestroyed ) {
556557 this . applyAttributesToElement ( ) ;
557558 this . callOnResize ( ) ;
558- this . _maybeRunPromiseResolveHasBeenInstalled ( ) ;
559559 }
560+ this . _maybeRunPromiseResolveHasBeenInstalled ?.( ) ;
560561 } ) ;
561562 }
562563
@@ -579,16 +580,17 @@ export default class ElementQueryModifier extends Modifier<ModifierArgs> {
579580
580581 this . resizeObserver . observe ( this . element , this . didResizeHandler ) ; // eslint-disable-line @typescript-eslint/unbound-method
581582
582- if ( ! this . args . named . isDisabled ) {
583+ if ( ! this . args . named . isDisabled && this . resizeObserver . isEnabled ) {
583584 return new Promise ( ( resolve ) => {
584585 this . _promiseResolveHasBeenInstalled = resolve ;
585586 } ) ;
587+ } else {
588+ return Promise . resolve ( ) ;
586589 }
587590 }
588591
589592 didUpdateArguments ( ) : void {
590- // @ts -ignore https://github.com/Microsoft/TypeScript/issues/28502#issuecomment-609607344
591- if ( ! ResizeObserver ) return ;
593+ if ( ! this . resizeObserver . isEnabled ) return ;
592594
593595 this . didResizeHandler ( ) ;
594596 }
You can’t perform that action at this time.
0 commit comments