nodeByID<T extends DOMNode> method

T? nodeByID<T extends DOMNode>(
  1. String? id
)

Returns a child node by id.

Implementation

T? nodeByID<T extends DOMNode>(String? id) {
  if (id == null || id.isEmpty || isEmptyContent) return null;
  if (id.startsWith('#')) id = id.substring(1);
  return nodeWhere((n) => n is DOMElement && n.id == id);
}