Problems with selection.data
/selection.datum
of d3-selection
#442
Labels
Milestone
selection.data
/selection.datum
of d3-selection
#442
I treated
selection.datum
the wrong way, I though that it just sets/gets the__data__
property and that's it. But by d3 philosophy is actually overwrites__data__
for a child when it is appended, see:https://github.com/d3/d3-selection/blob/e3b5455107/src/selection/append.js#L5
https://github.com/d3/d3-selection/blob/e3b5455107/src/selection/select.js#L9
Also see the issue and the comment: d3/d3-selection#106 (comment)
It affects the way I build HTML: for example, I create an HTML/SVG element corresponding to the Patch, set some data to it, and then at some point I create an HTML/SVG element corresponding to the Node, set another data to it, and append it to the parent Patch element. It turned out, at this point of appending, d3 literally overwrites the
__data__
property of a child with a data from a parent (see code above).At some point, I'll try to follow d3 philosophy (#441), but for now I will add my own
__rpd_data__
property and some function to access it easily and to replace it with something right in the future.The text was updated successfully, but these errors were encountered: