mbostock/d3 — pull request #1717 by volkmuth (2014-02-01 02:43:53+00:00)
Title: Fix for singleton ordinal domains

If an ordinal scale has a singleton domain and the range uses rangePoints or rangeBands, then all non-members of the domain will be mapped to the singleton member. They should be mapped to undefined instead.

[Also: The logic for returning the range given a domain value relied on javascript modulo returning NaN if the range is empty, and has the side effect that a "-1" property is added to the range for rangePoints/rangeBands ordinals where a non-domain member is mapped. Seems unlikely that anything actually relies on that behavior but I didn't try to clean it up just to be safe. Because of that, though, the code is still a little opaque, at least to me.]