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

Method Index

array.go:82–87  ·  view source on GitHub ↗

Index returns the position of the first element within the Selection object relative to its sibling elements.

()

Source from the content-addressed store, hash-verified

80// Index returns the position of the first element within the Selection object
81// relative to its sibling elements.
82func (s *Selection) Index() int {
83 if len(s.Nodes) > 0 {
84 return newSingleSelection(s.Nodes[0], s.document).PrevAll().Length()
85 }
86 return -1
87}
88
89// IndexSelector returns the position of the first element within the
90// Selection object relative to the elements matched by the selector, or -1 if

Callers 3

TestNbspFunction · 0.80
TestIndexFunction · 0.80
BenchmarkIndexFunction · 0.80

Calls 3

newSingleSelectionFunction · 0.85
LengthMethod · 0.80
PrevAllMethod · 0.80

Tested by 3

TestNbspFunction · 0.64
TestIndexFunction · 0.64
BenchmarkIndexFunction · 0.64