MCPcopy Create free account
hub / github.com/PuerkitoBio/goquery / IndexSelector

Method IndexSelector

array.go:98–104  ·  view source on GitHub ↗

IndexSelector returns the position of the first element within the Selection object relative to the elements matched by the selector, or -1 if not found.

(selector string)

Source from the content-addressed store, hash-verified

96// Selection object relative to the elements matched by the selector, or -1 if
97// not found.
98func (s *Selection) IndexSelector(selector string) int {
99 if len(s.Nodes) > 0 {
100 sel := s.document.Find(selector)
101 return indexInSlice(sel.Nodes, s.Nodes[0])
102 }
103 return -1
104}
105
106// IndexMatcher returns the position of the first element within the
107// Selection object relative to the elements matched by the matcher, or -1 if

Callers 3

TestIndexSelectorFunction · 0.80
TestIndexSelectorInvalidFunction · 0.80
BenchmarkIndexSelectorFunction · 0.80

Calls 2

indexInSliceFunction · 0.85
FindMethod · 0.80

Tested by 3

TestIndexSelectorFunction · 0.64
TestIndexSelectorInvalidFunction · 0.64
BenchmarkIndexSelectorFunction · 0.64