-
Notifications
You must be signed in to change notification settings - Fork 294
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
Setting NodeList length
in strict mode throws TypeError
#44
Comments
I’ll investigate, but a word of caution: as the README says, this module is currently an experimental API and is likely to change before 4.0 is released. This module and d3-transition are likely to be the last of the 4.0 modules to be released (since, in some sense, they are the most important to get the API right). So I wouldn’t recommend using this module in production yet. I am working on implementing the other modules first, so I can’t be as responsive fixing issues in the unreleased modules such as this one. That said, it is a bug if the code is trying to set the |
Also, it looks like you’re trying to call selection.text on the enter selection before appending. That shouldn’t fail, but it also won’t have any effect because you’re setting the selectAll('p')
.data(data)
.enter().append('p')
.text(d => d) |
Sure thing, this isn't a production app, so no damage there. The new stuff is too tempting to leave alone though :) Also, the example was thrown together, that's not app code, the failure is coming in As far as I can tell, the I'm really looking forward to using this stuff in production, happy to help bugbash if that's in the cards. |
Cool, just making sure. Another gotcha in your test case (probably unrelated to the bug) is that you didn’t select a node to append to, so your entering paragraph elements will get added to the document element rather than the body. The fix: select('body').selectAll('p')
.data(data)
.enter().append('p')
.text(d => d); |
Ah. Yeah in the app its a normal selection on a group of bar charts (similar to the crossfilter example). Works right if I leave d3.selectAll in there. |
The bug is only exhibited when calling selection.data on a top-level (flat) selection, rather than one nested under a parent element. That typically never happens because you instead specify a parent to append to. But it shouldn’t fail. Fix incoming. |
Awesome. Thanks for the fast fix.
|
I'm updating an app from d3 3.5.x and ran into an issue using selections in strict mode.
My code is a basic selection / data binding:
selection.selectAll('div').data(data)
. Data is an Array and the selection length is equal to the data length (4).This worked correctly in 3.5.x with strict mode. Now I'm getting a TypeError in the data method when it tries to set
update.length = dataLength
(src).Here's a reproducible test case, but the basic gist is this:
The text was updated successfully, but these errors were encountered: