indexOf method

int indexOf(
  1. Object? selector
)

Returns the index of a child node that matches selector.

Implementation

int indexOf(Object? selector) {
  if (selector == null || isEmptyContent) return -1;

  if (selector is num) {
    if (selector < 0) return -1;
    if (selector >= _content!.length) return _content!.length;
    return selector as int;
  } else {
    bool Function(DOMNode) nodeSelector = asNodeSelector(selector)!;
    return _content!.indexWhere(nodeSelector);
  }
}