selectWhere<T extends DOMNode> method

T? selectWhere<T extends DOMNode>(
  1. Object? selector
)

Returns a T child node that matches selector.

Implementation

T? selectWhere<T extends DOMNode>(Object? selector) {
  if (selector == null || isEmptyContent) return null;
  bool Function(DOMNode)? nodeSelector = asNodeSelector(selector);

  var found = nodeWhere(nodeSelector);
  if (found != null) return found as T?;

  for (var n in _content!.whereType<DOMNode>()) {
    found = n.selectWhere(nodeSelector);
    if (found != null) return found as T?;
  }

  return null;
}