Skip to content

insert() should accept iterable collections, not only arrays #3054

Description

@ryansolid

Moved from ryansolid/dom-expressions#294.

insert only walks arrays. A custom iterable of nodes (anything with Symbol.iterator that is not an array) is skipped with Unrecognized value. Skipped inserting. That shows up from non-JS producers (e.g. Squint) that hand JSX a collection rather than Array.from(...).

This is still real. It was never taken because walking general iterables on the insert hot path has a cost, and For / other list helpers would need the same treatment to be consistent.

Leaving it here as an enhancement for 2.x rather than a 1.x fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions