selectByID<T extends DOMNode> method

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

Returns a node T that has attribute id.

Implementation

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