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

Fix missing d3.transition in IE. Fixes #1491.

IE doesn’t support __proto__ patching, so if the selection.prototype.transition
method isn’t yet defined at the time d3_selectionRoot is defined, it won’t
inherit the method when the prototype is patched later! This restores the
original order of dependencies so that the transition method is defined before
d3_selectionRoot is created.
parent 354f54dd
{
"name": "d3",
"version": "3.3.1",
"version": "3.3.2",
"main": "d3.js",
"scripts": [
"d3.js"
......
......@@ -10,7 +10,7 @@
"animation",
"canvas"
],
"version": "3.3.1",
"version": "3.3.2",
"main": "index-browserify.js",
"scripts": [
"d3.js",
......
d3 = function() {
var d3 = {
version: "3.3.1"
version: "3.3.2"
};
if (!Date.now) Date.now = function() {
return +new Date();
......@@ -943,6 +943,29 @@ d3 = function() {
return node;
};
}
d3_selectionPrototype.transition = function() {
var id = d3_transitionInheritId || ++d3_transitionId, subgroups = [], subgroup, node, transition = d3_transitionInherit || {
time: Date.now(),
ease: d3_ease_cubicInOut,
delay: 0,
duration: 250
};
for (var j = -1, m = this.length; ++j < m; ) {
subgroups.push(subgroup = []);
for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
if (node = group[i]) d3_transitionNode(node, i, id, transition);
subgroup.push(node);
}
}
return d3_transition(subgroups, id);
};
d3_selectionPrototype.interrupt = function() {
return this.each(d3_selection_interrupt);
};
function d3_selection_interrupt() {
var lock = this.__transition__;
if (lock) ++lock.active;
}
d3.select = function(node) {
var group = [ typeof node === "string" ? d3_select(node, d3_document) : node ];
group.parentNode = d3_documentElement;
......@@ -7584,29 +7607,6 @@ d3 = function() {
return arguments.length ? d3_transitionInheritId ? selection.transition() : selection : d3_selectionRoot.transition();
};
d3.transition.prototype = d3_transitionPrototype;
d3_selectionPrototype.transition = function() {
var id = d3_transitionInheritId || ++d3_transitionId, subgroups = [], subgroup, node, transition = d3_transitionInherit || {
time: Date.now(),
ease: d3_ease_cubicInOut,
delay: 0,
duration: 250
};
for (var j = -1, m = this.length; ++j < m; ) {
subgroups.push(subgroup = []);
for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
if (node = group[i]) d3_transitionNode(node, i, id, transition);
subgroup.push(node);
}
}
return d3_transition(subgroups, id);
};
d3_selectionPrototype.interrupt = function() {
return this.each(d3_selection_interrupt);
};
function d3_selection_interrupt() {
var lock = this.__transition__;
if (lock) ++lock.active;
}
d3_transitionPrototype.select = function(selector) {
var id = this.id, subgroups = [], subgroup, subnode, node;
selector = d3_selection_selector(selector);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "d3",
"version": "3.3.1",
"version": "3.3.2",
"description": "A small, free JavaScript library for manipulating documents based on data.",
"keywords": [
"dom",
......
import "../transition/transition";
// import "../transition/transition";
import "selection";
d3_selectionPrototype.interrupt = function() {
......
......@@ -50,6 +50,9 @@ import "node";
import "size";
import "enter";
import "transition";
import "interrupt";
// TODO fast singleton implementation?
d3.select = function(node) {
var group = [typeof node === "string" ? d3_select(node, d3_document) : node];
......
import "../transition/transition";
// import "../transition/transition";
import "selection";
d3_selectionPrototype.transition = function() {
......
d3 = (function(){
var d3 = {version: "3.3.1"}; // semver
var d3 = {version: "3.3.2"}; // semver
......@@ -31,9 +31,6 @@ d3.transition = function(selection) {
d3.transition.prototype = d3_transitionPrototype;
import "../selection/transition";
import "../selection/interrupt";
import "select";
import "selectAll";
import "filter";
......
......@@ -6,7 +6,7 @@ var suite = vows.describe("selection.interrupt");
suite.addBatch({
"interrupt": {
topic: load("selection/interrupt").document(),
topic: load("transition/transition").document(),
"returns the current selection": function(d3) {
var selection = d3.select("body").append("div");
assert.strictEqual(selection.interrupt(), selection);
......
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