Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

checking children before attempting to get first child of a parent #387

Merged
merged 2 commits into from
Jun 22, 2017
Merged

checking children before attempting to get first child of a parent #387

merged 2 commits into from
Jun 22, 2017

Conversation

silverlight513
Copy link
Contributor

No description provided.

src/index.js Outdated
@@ -137,7 +137,7 @@ function render(vnode, parent, callback) {
if (prev && prev.parentNode!==parent) prev = null;

// default to first Element child
if (!prev) prev = parent.children[0];
if (parent.children && !prev) prev = parent.children[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought:

if (!prev && parent) prev = parent.firstElementChild;

@developit developit merged commit f972b66 into preactjs:master Jun 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants