selector function

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

Given the specified selector, returns a function which returns the first descendant of this element that matches the specified selector.

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

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

Is equivalent to:

final div = selection.select(d4.selector("div").u21);

Implementation

Element? Function(Element, [JSAny?, int?, List<Element?>?]) selector(
    [String? selector]) {
  return selector == null
      ? _none
      : (thisArg, [data, i, group]) {
          return PlaceholdableNodeExtension(thisArg).querySelector(selector);
        };
}