File tree Expand file tree Collapse file tree 1 file changed +11
-14
lines changed
Expand file tree Collapse file tree 1 file changed +11
-14
lines changed Original file line number Diff line number Diff line change @@ -75,17 +75,17 @@ let getOptions = (options: any): StandardBehaviorOptions => {
7575// Derived from code of Andy Desmarais
7676// https://terodox.tech/how-to-tell-if-an-element-is-in-the-dom-including-the-shadow-dom/
7777const isInDocument = ( element : Node ) => {
78- var currentElement = element ;
79- while ( currentElement && currentElement . parentNode ) {
80- if ( currentElement . parentNode === document ) {
81- return true ;
82- } else if ( currentElement . parentNode instanceof ShadowRoot ) {
83- currentElement = ( currentElement . parentNode as ShadowRoot ) . host ;
84- } else {
85- currentElement = currentElement . parentNode ;
86- }
78+ var currentElement = element
79+ while ( currentElement && currentElement . parentNode ) {
80+ if ( currentElement . parentNode === document ) {
81+ return true
82+ } else if ( currentElement . parentNode instanceof ShadowRoot ) {
83+ currentElement = ( currentElement . parentNode as ShadowRoot ) . host
84+ } else {
85+ currentElement = currentElement . parentNode
86+ }
8787 }
88- return false ;
88+ return false
8989}
9090
9191/**
@@ -123,10 +123,7 @@ function scrollIntoView<T = unknown>(
123123 options ?: StandardBehaviorOptions | CustomBehaviorOptions < T > | boolean
124124) : T | void {
125125 // Browsers treats targets that aren't in the dom as a no-op and so should we
126- if (
127- ! target . isConnected ||
128- ! isInDocument ( target )
129- ) {
126+ if ( ! target . isConnected || ! isInDocument ( target ) ) {
130127 return
131128 }
132129
You can’t perform that action at this time.
0 commit comments