File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -1070,10 +1070,10 @@ export namespace Widget {
1070
1070
if ( widget . parent ) {
1071
1071
throw new Error ( 'Cannot attach a child widget.' ) ;
1072
1072
}
1073
- if ( widget . isAttached || document . body . contains ( widget . node ) ) {
1073
+ if ( widget . isAttached || widget . node . isConnected ) {
1074
1074
throw new Error ( 'Widget is already attached.' ) ;
1075
1075
}
1076
- if ( ! document . body . contains ( host ) ) {
1076
+ if ( ! host . isConnected ) {
1077
1077
throw new Error ( 'Host is not attached.' ) ;
1078
1078
}
1079
1079
MessageLoop . sendMessage ( widget , Widget . Msg . BeforeAttach ) ;
@@ -1094,7 +1094,7 @@ export namespace Widget {
1094
1094
if ( widget . parent ) {
1095
1095
throw new Error ( 'Cannot detach a child widget.' ) ;
1096
1096
}
1097
- if ( ! widget . isAttached || ! document . body . contains ( widget . node ) ) {
1097
+ if ( ! widget . isAttached || ! widget . node . isConnected ) {
1098
1098
throw new Error ( 'Widget is not attached.' ) ;
1099
1099
}
1100
1100
MessageLoop . sendMessage ( widget , Widget . Msg . BeforeDetach ) ;
You can’t perform that action at this time.
0 commit comments