selectWithAllClasses<T extends DOMNode> method

T? selectWithAllClasses<T extends DOMNode>(
  1. List<String>? classes
)

Returns a node T that has all classes.

Implementation

T? selectWithAllClasses<T extends DOMNode>(List<String>? classes) {
  if (isEmptyObject(classes) || isEmptyContent) return null;

  classes = classes!
      .whereType<String>()
      .map((c) => c.trim())
      .where((c) => c.isNotEmpty)
      .toList();

  if (classes.isEmpty) return null;

  return selectWhere((n) => n is DOMElement && n.containsAllClasses(classes));
}