Skip to content

selection.selectChildren().remove() does not remove all children #275

@KirkMcDonald

Description

@KirkMcDonald

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions