Skip to content

Child nodes are cloned rather than updated when creating a container node #1987

@Goodwine

Description

@Goodwine

Example:

const decl = postcss.decl({ prop: 'foo', value: 'bar' });
const atRule = postcss.atRule({
  name: 'foo',
  nodes: [decl],
});
const comment = postcss.comment({ text: 'hello' });
// TypeError: Cannot read properties of undefined (reading 'insertBefore')
decl.before(comment);

Is this intended? I'd expect the child nodes to be updated, but instead they get cloned, and therefore the original instance is not updated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions