Description
Calling data() on a selection created from a DOM element appears to fail when D3 attempts to create EnterNodes.
The following works:
d3.select('#app').data([1, 2, 3, 4]);
but the equivalent selection created from the DOM element itself throws:
d3.select(document.getElementById('app')).data([1, 2, 3, 4]);
Uncaught TypeError: Cannot read properties of null (reading 'ownerDocument') at new EnterNode (d3-selection.js?v=2f31b0b4:142:30) at bindIndex (d3-selection.js?v=2f31b0b4:177:20)...
Shouldn't both snippets result in indentical execution?
Reproduction
<div id="app"></div>
<script>
d3.select(document.getElementById('app'))
.data([1, 2, 3, 4]);
</script>
Environment
d3-selection : 3.0.0
browser : Chrome Version 147.0.7727.55 (Official Build) (64-bit)
Description
Calling data() on a selection created from a DOM element appears to fail when D3 attempts to create EnterNodes.
The following works:
d3.select('#app').data([1, 2, 3, 4]);
but the equivalent selection created from the DOM element itself throws:
d3.select(document.getElementById('app')).data([1, 2, 3, 4]);
Uncaught TypeError: Cannot read properties of null (reading 'ownerDocument') at new EnterNode (d3-selection.js?v=2f31b0b4:142:30) at bindIndex (d3-selection.js?v=2f31b0b4:177:20)...Shouldn't both snippets result in indentical execution?
Reproduction
Environment
d3-selection : 3.0.0
browser : Chrome Version 147.0.7727.55 (Official Build) (64-bit)