MCPcopy Create free account
hub / github.com/andybalholm/cascadia / writeNodeText

Function writeNodeText

pseudo_classes.go:127–136  ·  view source on GitHub ↗

writeNodeText writes the text contained in n and its descendants to b.

(n *html.Node, b *bytes.Buffer)

Source from the content-addressed store, hash-verified

125
126// writeNodeText writes the text contained in n and its descendants to b.
127func writeNodeText(n *html.Node, b *bytes.Buffer) {
128 switch n.Type {
129 case html.TextNode:
130 b.WriteString(n.Data)
131 case html.ElementNode:
132 for c := n.FirstChild; c != nil; c = c.NextSibling {
133 writeNodeText(c, b)
134 }
135 }
136}
137
138// nodeText returns the text contained in n and its descendants.
139func nodeText(n *html.Node) string {

Callers 1

nodeTextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected