Previously, these would work by coercing the input color to a string and then
parsing it. This is slow, but more importantly, this is a lossy process for HSL
colors due to the conversion to hexadecimal RGB format. This commit detects
instances of d3_Rgb and d3_Hsl on input and copies them efficiently.
When computing the reversed baseline, we need to switch between step-before and
step-after, since the points are in reverse order. Otherwise, we're effectively
filling the gap between step-before and step-after.
Using the comma operator isn't so bad, and I added it to removeAttribute
for good measure in case there's an implementation out there that
returns something.
This also tweaks the array conversion slightly so that it is called by
selection.selectAll rather than d3_selectAll; this guarantees that the selection
groups are always arrays, even when a function selector is used.
The click event is prevented from propagating when a drag has occurred
i.e. the mouse has moved between mousedown and mouseup. This is because
a click event will be triggered after a mousedown and mouseup have
occurred on the same element. However, we were cancelling the next
click event *anywhere*, regardless of whether mousedown and mouseup
occurred on the same element or not.
As a sanity check, we also check that the click event was triggered on
the same element that mousedown *and* mouseup occurred on, before
cancelling it. Just in case!
This adds support for filtering the log ticks, such that fewer ticks can be
generated to fit in a small space. This can be used in conjunction with a
custom tick format as well. This commit also changes the default log tick format
to be exponential rather than precision, for consistency.
NodeList doesn't support .sort() directly, so we need to convert to a
real Array first. I've done this in selectAll for efficiency i.e. this
avoids a new Array being created every time the same selection is
sorted. However, it may be slightly more efficient to create the Array
only when sorting, to avoid unnecessary Array creation when sorting
isn't used, which is probably the common case.
Unfortunately it's difficult to test this because JSDOM uses a real
Array instead of a NodeList!
Rather than have a treshold in transitions, we now clamp the easing functions.
This guarantees that when the transition ends, the tweens will be called with
t=1, and produce clean output values. Previously, that was not the case for
certain easing functions, such as exp-out and elastic.
IE9 does not string-coerce values, instead throwing an error. We now wrap IE9's
implementation to force string coercion. While it would be simpler to turn on
string-coercion for all browsers inside D3's style operator, this approach
avoids penalizing standards-compliant browsers.
This commit also moves language-compatibility code to a separate directory, and
deletes the obsolete Object.create polyfill, which is no longer needed by D3.
This improves the performance of transitions that have already ended (those with
zero duration), as the transition can end immediately on start rather than
waiting for a second tick.
Fixes#274. String coerce for uniqueness, but store the original input types in
the domain for subsequent retrieval. This way, you can more easily use
non-strings as domain values (such as dates or numbers).
As of 2.0.0, it's possible to have multiple transitions running concurrently
with the same id. Thus, it is no longer sufficient to check the transition id
to decide whether to delete the transition lock. We now use reference counting
to determine the number of transitions that are scheduled on a given element;
when that number drops to zero, we can delete the transition lock.
This fixes a breakage on IE9, which doesn't support array subclassing through
prototype injection. On IE9, we then use direct extension of the prototype, but
this can only be done after the prototype is fully-defined.