File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed
Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 44import * as React from 'react' ;
55import * as ReactDOM from 'react-dom' ;
66import { Omit } from '../declarations/omit' ;
7+ import * as dom from '../utils/dom' ;
78
89const DEBUG = false ;
910export const CHILDREN_TO_APPEND_PROP = 'children-to-append' ;
@@ -48,7 +49,7 @@ export class ReactContent extends React.PureComponent<AllReactContentProps> {
4849 const hostElement = this . props . legacyRenderMode ? element : element . parentElement ;
4950
5051 // Only add children not already in the DOM
51- this . props [ CHILDREN_TO_APPEND_PROP ] . filter ( child => ! child . isConnected ) . forEach ( child =>
52+ this . props [ CHILDREN_TO_APPEND_PROP ] . filter ( child => ! dom . isNodeInDOM ( child ) ) . forEach ( child =>
5253 hostElement . appendChild ( child )
5354 ) ;
5455 }
Original file line number Diff line number Diff line change 1+ /**
2+ * Checks if a node is in the DOM.
3+ *
4+ * @param node The node to check
5+ * @returns whether the node is in the DOM
6+ */
7+ export const isNodeInDOM = ( node : Node ) => node . isConnected || document . body . contains ( node ) ;
Original file line number Diff line number Diff line change 1+ export * from './dom-utils' ;
You can’t perform that action at this time.
0 commit comments