From 14a0c487b886d6ec301a6ae53e15e489e91cde8d Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Wed, 5 Oct 2016 09:43:05 +0530 Subject: [PATCH] Fix walk with non-container root nodes When passed a non-container root node, the former algorithm would go on walking down the rest of the tree beyond the root. The former walk fix was supposed to do that but somehow the code disappeared in the process. --- node.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node.go b/node.go index 3360e5b..8f10698 100644 --- a/node.go +++ b/node.go @@ -309,7 +309,7 @@ func newNodeWalker(root *Node) *nodeWalker { } func (nw *nodeWalker) next() { - if !nw.entering && nw.current == nw.root { + if (!nw.current.isContainer() || !nw.entering) && nw.current == nw.root { nw.current = nil return }