selectorAll function

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

Given the specified selector, returns a function which returns all descendants of this element that match the specified selector.

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

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

Is equivalent to:

final div = selection.selectAll(d4.selectorAll("div").u21);

Implementation

List<Element?> Function(Element, [JSAny?, int?, List<Element?>?]) selectorAll(
    [String? selector]) {
  return selector == null
      ? _empty
      : (thisArg, [data, i, group]) {
          final nodeList =
              PlaceholdableNodeExtension(thisArg).querySelectorAll(selector);
          return [
            for (var i = 0; i < nodeList.length; i++)
              nodeList.item(i) as Element?
          ];
        };
}