all repos — grayfriday @ b98aa06008196b3fd3c561305a871978113be869

blackfriday fork with a few changes

Export Node.IsContainer
Tom Payne twpayne@gmail.com
Tue, 23 Apr 2019 22:10:42 +0200
commit

b98aa06008196b3fd3c561305a871978113be869

parent

792d13404204e12d4c292c77184f47ad325fcfdc

1 files changed, 4 insertions(+), 3 deletions(-)

jump to
M node.gonode.go

@@ -199,7 +199,8 @@ sibling.Parent.FirstChild = sibling

} } -func (n *Node) isContainer() bool { +// IsContainer returns true if 'n' can contain children. +func (n *Node) IsContainer() bool { switch n.Type { case Document: fallthrough

@@ -309,11 +310,11 @@ }

} func (nw *nodeWalker) next() { - if (!nw.current.isContainer() || !nw.entering) && nw.current == nw.root { + if (!nw.current.IsContainer() || !nw.entering) && nw.current == nw.root { nw.current = nil return } - if nw.entering && nw.current.isContainer() { + if nw.entering && nw.current.IsContainer() { if nw.current.FirstChild != nil { nw.current = nw.current.FirstChild nw.entering = true