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

Method IndexMatcher

array.go:103–109  ·  view source on GitHub ↗

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

(m Matcher)

Source from the content-addressed store, hash-verified

101// Selection object relative to the elements matched by the matcher, or -1 if
102// not found.
103func (s *Selection) IndexMatcher(m Matcher) int {
104 if len(s.Nodes) > 0 {
105 sel := s.document.FindMatcher(m)
106 return indexInSlice(sel.Nodes, s.Nodes[0])
107 }
108 return -1
109}
110
111// IndexOfNode returns the position of the specified node within the Selection
112// object, or -1 if not found.

Callers

nothing calls this directly

Calls 2

indexInSliceFunction · 0.85
FindMatcherMethod · 0.80

Tested by

no test coverage detected