Closed sghall closed 7 years ago
1. It’d be cleaner (in only one place) if you move the coercion to the call location rather than the function. That is:
(fullname.local ? attrConstantNS : attrConstant)(fullname, i, value + "")
2. You should make the equivalent fix in transition/style.js.
Right on. That should do it! I just did the commits on the interface here. Squash 'em on the merge 👍 Really liking these separate d3 modules. Nice work.
Nice work. Thank you.
Note, that this breaks the algorithm used to determine the correct interpolator as described in the docs:
- If value is a number, use interpolateNumber.
- If value is a color or a string coercible to a color, use interpolateRgb.
- Use interpolateString.
Since the function will always be called with the new value as a string there is no way for interpolateNumber to be chosen. For a discussion of this issue have a look at "What attribute change does d3 transition include?".
interpolateString (or interpolateRgb) is the correct behavior here. interpolateNumber should never be used for attributes.
@mbostock I was about to protest your initial comment until you added the second sentence to it, which seems reasonable to me ;-) If this is the desired behavior, however, the documentation needs to be adjusted as it still allows for interpolateNumber, right?
getAttribute will always return a string. It looks like this was in there a few commits back. Not sure on the syntax, but just wanted to point it out. Could also use a template string in ES6
${value1}
.