d3.svg.axis: avoid setting invalid transform attr.

Fixes #1968.  For example, when switching from a linear scale to a
logarithmic scale, some of the exiting ticks might be positioned at
Infinity in the new scale (zero and negative numbers).  This can cause a
warning to be logged in the console due to the resulting invalid
transform attribute.  The warning doesn’t prevent the rest of the axis
from functioning normally (even though it is logged as an “error”), but
it is preferable to avoid setting invalid attributes.
Shorten.
Oops, too short.
Fix group formatting and padding.

Very small or large numbers use exponent notation when converted to
strings.  If grouping is enabled and there is no decimal, the exponent
wasn’t being ignored, so the group separator was in the wrong place.

This also fixes a bug relating to padding and thousands grouping: the
padding calculation assumed a grouping of [3].

Fixes #1972, #1994.
Fix #2039: improve [un]interpolateNumber precision.

* uninterpolate:

The use of a reciprocal in d3_uninterpolateNumber to avoid division
results in a small loss of precision (the following is a paraphrase):

  function d3_uninterpolateNumber(a, b) {
    var k = b - a ? 1 / (b - a) : 0;
    return function(x) { return (x - a) * k; };
  }

For x = a, there is no problem, since u = (a - a) * k = 0 * k = 0 as
expected.  For x = b, we have u = (b - a) * k, and since k cannot
represent 1 / (b - a) exactly, we don’t get u = 1, but something very
close to 1.

Instead, if we perform the division within the generated function, we
can ensure we always get u = 1 for x = b:

  function d3_uninterpolateNumber(a, b) {
    var k = b - a || Infinity;
    return function(x) { return (x - a) / k; };
  }

Again, for x = a, we simply have u = (a - a) / k = 0.  For x = b, we
have u = (b - a) / k = (b - a) / (b - a) = 1.

* interpolate:

Similarly, for d3_interpolateNumber, we have a small loss of precision,
this time due to subtraction.  Paraphrased:

  function d3_interpolateNumber(a, b) {
    var d = b - a;
    return function(t) { return a + t * d; };
  }

There is no issue for t = 0, because we always get i = a + 0 * d = a.
However, for t = 1, we get i = a + d, which might not be exactly equal
to b as desired.  The following will return precisely b for t = 1:

  function d3_interpolateNumber(a, b) {
    return function(t) { return a * (1 - t) + b * t; };
  }
Fix d3.layout.stack for empty input array.

Fixes #2004.
Fix #2010 - check for nully, not falsey.
Remove CSSStyleDeclaration fix.

This is no longer necessary with the upgrade to JSDOM 1.0.
Fix #2006 - prevent leak of d3 global in node.
Slightly simpler version using d3_zero.

As suggested by @mbostock.  Note that we preserve the behaviour for
ranges that are coerced to NaNs.
Add test for coercion of mixed range.
No d3_zero.
Save a whopping 12 bytes!
Fix d3.lab(d3.hcl(…)).

Due to the tests using two different copies of d3 (one loaded via require, and
the other via smash), the instanceof check in the d3.lab constructor was
returning false when testing for d3.hcl, and this constructor was therefore
never tested.
Optimize selection.data(values, key)

Preallocate the keyValues array and use a single Map with the
sentinel value `true` to represent a previously seen key.

Before:

selection.data(values, key) (enter) 1.5ms/op.
selection.data(values, key) (update) 1.7ms/op.

After:

selection.data(values, key) (enter) 0.81ms/op.
selection.data(values, key) (update) 1.1ms/op.
Optimize d3.{map,set}.

Rather than always escaping keys with a null-prefix, only escape keys that can
conflict with built-in properties (either on Object, d3_Map or d3_Set). By only
prefixing these special keys, we can avoid the cost of constructing new strings
in the common case.

To check whether a key is special, we check whether it is in an empty map
instance. In addition, keys that are already null-prefixed must be prefixed a
second time to correctly unescape.
Slight simplification.
Add @jfirebaugh’s benchmark.
Reformat slightly.
Use Object.create(null) for maps.