Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for null node in selection.data. #2598

Merged
merged 1 commit into from Oct 24, 2015
Merged

Fix for null node in selection.data. #2598

merged 1 commit into from Oct 24, 2015

Conversation

mbostock
Copy link
Member

If a selection is missing elements, then selection.data would still attempt to evaluate the optional key function for the missing elements, resulting in an uncaught TypeError. For example:

d3.selectAll("p")
  .select(function(d, i) { return i & 1 ? this : null; })
    .data([1, 2, 3], Number);

Now, any missing elements are automatically assigned to the exit selection.

If a selection is missing elements, then selection.data would still attempt to
evaluate the optional key function for the missing elements, resulting in an
uncaught TypeError. For example:

  d3.selectAll("p")
    .select(function(d, i) { return i & 1 ? this : null; })
      .data([1, 2, 3], Number);

Now, any missing elements are automatically assigned to the exit selection.
@mbostock mbostock added the bug Something isn’t working label Oct 24, 2015
@mbostock mbostock added this to the 3.5.7 milestone Oct 24, 2015
@mbostock mbostock merged commit 7eaf442 into 3.5.7 Oct 24, 2015
@mbostock mbostock deleted the fix-null branch October 24, 2015 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn’t working
Development

Successfully merging this pull request may close these issues.

None yet

1 participant