Skip to content

Commit

Permalink
Simplify getDomSibling (-12 B)
Browse files Browse the repository at this point in the history
With #1700 complete, we can now rely on the sibling._dom pointer to tell us if that subtree contains a rendered DOM node and what the first dom is.
  • Loading branch information
andrewiggins committed Jun 25, 2019
1 parent a109fb9 commit acbebbc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ export function getDomSibling(vnode, childIndex) {
for (; childIndex < vnode._children.length; childIndex++) {
sibling = vnode._children[childIndex];

if (sibling != null) {
return typeof sibling.type !== 'function'
? sibling._dom
: getDomSibling(sibling, 0);
if (sibling != null && sibling._dom != null) {
// Since updateParentDomPointers keeps _dom pointer correct,
// we can rely on _dom to tell us if this subtree contains a
// rendered DOM node, and what the first rendered DOM node is
return sibling._dom;
}
}

Expand Down

0 comments on commit acbebbc

Please sign in to comment.