File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -64,19 +64,19 @@ function scrollIntoView<T>(
64
64
function scrollIntoView ( target : Element , options ?: Options | boolean ) : void
65
65
function scrollIntoView < T > ( target : Element , options ?: Options < T > | boolean ) {
66
66
// Browsers treats targets that aren't in the dom as a no-op and so should we
67
- const targetIsDetached = ! target . ownerDocument ! . documentElement ! . contains (
68
- target
69
- )
67
+ const isTargetAttached =
68
+ target . isConnected ||
69
+ target . ownerDocument ! . documentElement ! . contains ( target )
70
70
71
71
if (
72
72
isOptionsObject < CustomBehaviorOptions < T > > ( options ) &&
73
73
typeof options . behavior === 'function'
74
74
) {
75
- return options . behavior ( targetIsDetached ? [ ] : compute ( target , options ) )
75
+ return options . behavior ( isTargetAttached ? compute ( target , options ) : [ ] )
76
76
}
77
77
78
78
// Don't do anything if using a standard behavior on an element that is not in the document
79
- if ( targetIsDetached ) {
79
+ if ( ! isTargetAttached ) {
80
80
return
81
81
}
82
82
You can’t perform that action at this time.
0 commit comments