Merge branch 'simplify-arguments' of git://github.com/jasondavies/d3 into 3.0

Conflicts:
	src/core/ease.js
	src/core/selection-datum.js
This commit is contained in:
Mike Bostock 2012-10-29 08:50:22 -07:00
Родитель 92ae464cc9 c0f27752a3
Коммит 9828afda19
7 изменённых файлов: 25 добавлений и 26 удалений

17
d3.js поставляемый
Просмотреть файл

@ -157,10 +157,7 @@
function d3_ease_elastic(a, p) {
var s;
if (arguments.length < 2) p = .45;
if (arguments.length < 1) {
a = 1;
s = p / 4;
} else s = p / (2 * π) * Math.asin(1 / a);
if (arguments.length) s = p / (2 * π) * Math.asin(1 / a); else a = 1, s = p / 4;
return function(t) {
return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * π / p);
};
@ -823,7 +820,7 @@
};
scale.tickFormat = function(n, format) {
if (arguments.length < 2) format = d3_scale_logFormat;
if (arguments.length < 1) return format;
if (!arguments.length) return format;
var k = Math.max(.1, n / scale.ticks().length), f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil), e;
return function(d) {
return d / pow(f(log(d) + e)) <= k ? format(d) : "";
@ -4074,24 +4071,24 @@
return this.each(d3_selection_property(name, value));
};
d3_selectionPrototype.text = function(value) {
return arguments.length < 1 ? this.node().textContent : this.each(typeof value === "function" ? function() {
return arguments.length ? this.each(typeof value === "function" ? function() {
var v = value.apply(this, arguments);
this.textContent = v == null ? "" : v;
} : value == null ? function() {
this.textContent = "";
} : function() {
this.textContent = value;
});
}) : this.node().textContent;
};
d3_selectionPrototype.html = function(value) {
return arguments.length < 1 ? this.node().innerHTML : this.each(typeof value === "function" ? function() {
return arguments.length ? this.each(typeof value === "function" ? function() {
var v = value.apply(this, arguments);
this.innerHTML = v == null ? "" : v;
} : value == null ? function() {
this.innerHTML = "";
} : function() {
this.innerHTML = value;
});
}) : this.node().innerHTML;
};
d3_selectionPrototype.append = function(name) {
function append() {
@ -4207,7 +4204,7 @@
return update;
};
d3_selectionPrototype.datum = function(value) {
return arguments.length < 1 ? this.property("__data__") : this.property("__data__", value);
return arguments.length ? this.property("__data__", value) : this.property("__data__");
};
d3_selectionPrototype.filter = function(filter) {
var subgroups = [], subgroup, group, node;

8
d3.min.js поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -84,8 +84,8 @@ function d3_ease_circle(t) {
function d3_ease_elastic(a, p) {
var s;
if (arguments.length < 2) p = 0.45;
if (arguments.length < 1) { a = 1; s = p / 4; }
else s = p / (2 * π) * Math.asin(1 / a);
if (arguments.length) s = p / (2 * π) * Math.asin(1 / a);
else a = 1, s = p / 4;
return function(t) {
return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * π / p);
};

Просмотреть файл

@ -1,5 +1,5 @@
d3_selectionPrototype.datum = function(value) {
return arguments.length < 1
? this.property("__data__")
: this.property("__data__", value);
return arguments.length
? this.property("__data__", value)
: this.property("__data__");
};

Просмотреть файл

@ -1,7 +1,8 @@
d3_selectionPrototype.html = function(value) {
return arguments.length < 1
? this.node().innerHTML : this.each(typeof value === "function"
return arguments.length
? this.each(typeof value === "function"
? function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; } : value == null
? function() { this.innerHTML = ""; }
: function() { this.innerHTML = value; });
: function() { this.innerHTML = value; })
: this.node().innerHTML;
};

Просмотреть файл

@ -1,7 +1,8 @@
d3_selectionPrototype.text = function(value) {
return arguments.length < 1
? this.node().textContent : this.each(typeof value === "function"
return arguments.length
? this.each(typeof value === "function"
? function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; } : value == null
? function() { this.textContent = ""; }
: function() { this.textContent = value; });
: function() { this.textContent = value; })
: this.node().textContent;
};

Просмотреть файл

@ -50,7 +50,7 @@ function d3_scale_log(linear, log) {
scale.tickFormat = function(n, format) {
if (arguments.length < 2) format = d3_scale_logFormat;
if (arguments.length < 1) return format;
if (!arguments.length) return format;
var k = Math.max(.1, n / scale.ticks().length),
f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil),
e;