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 => {
75
75
// Derived from code of Andy Desmarais
76
76
// https://terodox.tech/how-to-tell-if-an-element-is-in-the-dom-including-the-shadow-dom/
77
77
const 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
+ }
87
87
}
88
- return false ;
88
+ return false
89
89
}
90
90
91
91
/**
@@ -123,10 +123,7 @@ function scrollIntoView<T = unknown>(
123
123
options ?: StandardBehaviorOptions | CustomBehaviorOptions < T > | boolean
124
124
) : T | void {
125
125
// 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 ) ) {
130
127
return
131
128
}
132
129
You can’t perform that action at this time.
0 commit comments