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

Method IndexMatcher

array.go:109–115  ·  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

107// Selection object relative to the elements matched by the matcher, or -1 if
108// not found.
109func (s *Selection) IndexMatcher(m Matcher) int {
110 if len(s.Nodes) > 0 {
111 sel := s.document.FindMatcher(m)
112 return indexInSlice(sel.Nodes, s.Nodes[0])
113 }
114 return -1
115}
116
117// IndexOfNode returns the position of the specified node within the Selection
118// 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