Commit a2a91438 authored by Mike Bostock's avatar Mike Bostock
Browse files

Merge selection-root into selection.

parent e64b6220
......@@ -1046,14 +1046,6 @@ d3 = function() {
}
return null;
};
var d3_selectionRoot = d3_selection([ [ d3_document ] ]);
d3_selectionRoot[0].parentNode = d3_selectRoot;
d3.select = function(selector) {
return typeof selector === "string" ? d3_selectionRoot.select(selector) : d3_selection([ [ selector ] ]);
};
d3.selectAll = function(selector) {
return typeof selector === "string" ? d3_selectionRoot.selectAll(selector) : d3_selection([ d3_array(selector) ]);
};
function d3_selection_enter(selection) {
d3_arraySubclass(selection, d3_selection_enterPrototype);
return selection;
......@@ -1082,6 +1074,14 @@ d3 = function() {
}
return d3_selection(subgroups);
};
var d3_selectionRoot = d3_selection([ [ d3_document ] ]);
d3_selectionRoot[0].parentNode = d3_selectRoot;
d3.select = function(selector) {
return typeof selector === "string" ? d3_selectionRoot.select(selector) : d3_selection([ [ selector ] ]);
};
d3.selectAll = function(selector) {
return typeof selector === "string" ? d3_selectionRoot.selectAll(selector) : d3_selection([ d3_array(selector) ]);
};
d3.behavior.zoom = function() {
var translate = [ 0, 0 ], translate0, scale = 1, scale0, scaleExtent = d3_behavior_zoomInfinity, event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime;
function zoom() {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
import "ns";
import "selection";
import "selection-select";
import "selection-selectAll";
import "selection-attr";
import "selection-classed";
import "selection-style";
import "selection-property";
import "selection-text";
import "selection-html";
import "selection-append";
import "selection-insert";
import "selection-remove";
import "selection-data";
import "selection-datum";
import "selection-filter";
import "selection-order";
import "selection-sort";
import "selection-on";
import "selection-each";
import "selection-call";
import "selection-empty";
import "selection-node";
import "selection-root";
import "selection-enter";
import "selection-enter-select";
......@@ -15,3 +15,5 @@ d3_selection_enterPrototype.append = d3_selectionPrototype.append;
d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;
d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
d3_selection_enterPrototype.node = d3_selectionPrototype.node;
import "selection-enter-select";
import "../core/array";
import "../core/document";
import "selection";
var d3_selectionRoot = d3_selection([[d3_document]]);
d3_selectionRoot[0].parentNode = d3_selectRoot;
// TODO fast singleton implementation!
// TODO select(function)
d3.select = function(selector) {
return typeof selector === "string"
? d3_selectionRoot.select(selector)
: d3_selection([[selector]]); // assume node
};
// TODO selectAll(function)
d3.selectAll = function(selector) {
return typeof selector === "string"
? d3_selectionRoot.selectAll(selector)
: d3_selection([d3_array(selector)]); // assume node[]
};
......@@ -26,3 +26,45 @@ d3.selection = function() {
};
d3.selection.prototype = d3_selectionPrototype;
import "selection-select";
import "selection-selectAll";
import "selection-attr";
import "selection-classed";
import "selection-style";
import "selection-property";
import "selection-text";
import "selection-html";
import "selection-append";
import "selection-insert";
import "selection-remove";
import "selection-data";
import "selection-datum";
import "selection-filter";
import "selection-order";
import "selection-sort";
import "selection-on";
import "selection-each";
import "selection-call";
import "selection-empty";
import "selection-node";
import "selection-enter";
var d3_selectionRoot = d3_selection([[d3_document]]);
d3_selectionRoot[0].parentNode = d3_selectRoot;
// TODO fast singleton implementation!
// TODO select(function)
d3.select = function(selector) {
return typeof selector === "string"
? d3_selectionRoot.select(selector)
: d3_selection([[selector]]); // assume node
};
// TODO selectAll(function)
d3.selectAll = function(selector) {
return typeof selector === "string"
? d3_selectionRoot.selectAll(selector)
: d3_selection([d3_array(selector)]); // assume node[]
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment