MCPcopy
hub / github.com/PuerkitoBio/goquery / PrependNodes

Method PrependNodes

manipulation.go:217–223  ·  view source on GitHub ↗

PrependNodes prepends the specified nodes to each node in the set of matched elements. This follows the same rules as Selection.Append.

(ns ...*html.Node)

Source from the content-addressed store, hash-verified

215//
216// This follows the same rules as Selection.Append.
217func (s *Selection) PrependNodes(ns ...*html.Node) *Selection {
218 return s.manipulateNodes(ns, true, func(sn *html.Node, n *html.Node) {
219 // sn.FirstChild may be nil, in which case this functions like
220 // sn.AppendChild()
221 sn.InsertBefore(n, sn.FirstChild)
222 })
223}
224
225// Remove removes the set of matched elements from the document.
226// It returns the same selection, now consisting of nodes not in the document.

Callers 2

PrependMatcherMethod · 0.95
PrependSelectionMethod · 0.95

Calls 1

manipulateNodesMethod · 0.95

Tested by

no test coverage detected