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)
| 96 | // Selection object relative to the elements matched by the selector, or -1 if |
| 97 | // not found. |
| 98 | func (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 |