selection.selectChildren().remove() does not remove all children
KirkMcDonald opened this issue · comments
KirkMcDonald commented
For example, given the following HTML:
<div id="content">
<span>0</span>
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
<span>5</span>
<span>6</span>
<span>7</span>
<span>8</span>
<span>9</span>
</div>
The expression d3.select("#content").selectChildren().remove()
will only remove the even-numbered elements. I find this behavior surprising, and would naively expect it to remove all of the <span>
tags.
In contrast, the expression d3.select("#content").selectAll("*").remove()
will remove all of the <span>
tags.
Philippe Rivière commented