source: node_modules/d3-selection/src/selection/selectAll.js@ e4c61dd

Last change on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Prototype 1.1

  • Property mode set to 100644
File size: 730 bytes
Line 
1import {Selection} from "./index.js";
2import array from "../array.js";
3import selectorAll from "../selectorAll.js";
4
5function arrayAll(select) {
6 return function() {
7 return array(select.apply(this, arguments));
8 };
9}
10
11export default function(select) {
12 if (typeof select === "function") select = arrayAll(select);
13 else select = selectorAll(select);
14
15 for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
16 for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
17 if (node = group[i]) {
18 subgroups.push(select.call(node, node.__data__, i, group));
19 parents.push(node);
20 }
21 }
22 }
23
24 return new Selection(subgroups, parents);
25}
Note: See TracBrowser for help on using the repository browser.