Skip to content

Instantly share code, notes, and snippets.

@byron-perez
Created July 6, 2017 17:55
Show Gist options
  • Save byron-perez/25beec7a0597d981a19451c07dbe2b42 to your computer and use it in GitHub Desktop.
Save byron-perez/25beec7a0597d981a19451c07dbe2b42 to your computer and use it in GitHub Desktop.
ejercicio06072017
nextNode = function(node) {
//...Code goes here to walk to the next node...
if(node.childNodes.length != 0)
{
return node.firstChild;
}
else if(node.childNodes.length == 0 && node.nextSibling != null)
{
return node.nextSibling;
}
else if(node.nextSibling == null)
{
while(node.parentNode.nextSibling == null)
{
node = node.parentNode;
}
return node.parentNode.nextSibling;
}
else
{
return node;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment