Index returns the position of the first element within the Selection object relative to its sibling elements.
()
| 80 | // Index returns the position of the first element within the Selection object |
| 81 | // relative to its sibling elements. |
| 82 | func (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 |