Skip to content

Commit 674f226

Browse files
committed
Remove contains with a simple parentNode check (#4666)
1 parent 96e8488 commit 674f226

File tree

4 files changed

+1
-4
lines changed

4 files changed

+1
-4
lines changed

compat/src/portals.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ function Portal(props) {
3939
nodeType: 1,
4040
parentNode: container,
4141
childNodes: [],
42-
contains: () => true,
4342
// Technically this isn't needed
4443
appendChild(child) {
4544
this.childNodes.push(child);

src/diff/children.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ function insert(parentVNode, oldDom, parentDom) {
340340

341341
return oldDom;
342342
} else if (parentVNode._dom != oldDom) {
343-
if (oldDom && parentVNode.type && !parentDom.contains(oldDom)) {
343+
if (oldDom && parentVNode.type && !oldDom.parentNode) {
344344
oldDom = getDomSibling(parentVNode);
345345
}
346346
parentDom.insertBefore(parentVNode._dom, oldDom || NULL);

src/index-5.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ interface ContainerNode {
290290
readonly firstChild: ContainerNode | null;
291291
readonly childNodes: ArrayLike<ContainerNode>;
292292

293-
contains(other: ContainerNode | null): boolean;
294293
insertBefore(node: ContainerNode, child: ContainerNode | null): ContainerNode;
295294
appendChild(node: ContainerNode): ContainerNode;
296295
removeChild(child: ContainerNode): ContainerNode;

src/index.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ interface ContainerNode {
289289
readonly firstChild: ContainerNode | null;
290290
readonly childNodes: ArrayLike<ContainerNode>;
291291

292-
contains(other: ContainerNode | null): boolean;
293292
insertBefore(node: ContainerNode, child: ContainerNode | null): ContainerNode;
294293
appendChild(node: ContainerNode): ContainerNode;
295294
removeChild(child: ContainerNode): ContainerNode;

0 commit comments

Comments
 (0)