matcher function

bool Function(Element, [JSAny?, int?, List<Element?>?]) matcher(
  1. String selector
)

Given the specified selector, returns a function which returns true if this element matches the specified selector.

This method is used internally by selection.filter. For example, this:

final div = selection.filter("div".u22);

Is equivalent to:

final div = selection.filter(d4.matcher("div"));

(Although D4 is not a compatibility layer, this implementation does support vendor-prefixed implementations due to the recent standardization of element.matches.)

Implementation

bool Function(Element, [JSAny?, int?, List<Element?>?]) matcher(
    String selector) {
  return (Element thisArg, [_, __, ___]) {
    return thisArg.matches(selector);
  };
}