Skip to content

selection.appendAll #301

@mbostock

Description

@mbostock

What if this

svg.append("g")
  .appendAll("rect", data)

were shorthand for this

svg.append("g")
  .selectAll()
  .data(data)
  .enter()
  .append("rect")

The latter is a common special case of the data-join, and it seems worthwhile to support it explicitly? Some optimizations:

  • You don’t need a selector (pass undefined to selection.selectAll, which is already optimized)
  • You don’t need a key function (because the initial selection is necessarily empty)
  • You only need the enter selection (because the initial selection is necessarily empty)
  • You don’t need to call selection.order (because the initial selection is necessarily empty)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions