Skip to content

Version 6.34.0 introduces a breaking change with cloneNode #1519

@OldHippie67

Description

@OldHippie67

Describe the issue

The notes for version 6.34.0 state "...and uses cloneNode when a raw element is passed in ..."

Cloning a node does not copy event listeners added using addEventListener() or those assigned to element properties (e.g., node.onclick = someFunction). https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode

An HTMLElement created like this

    const buttonElement = document.createElement("button");
    buttonElement.innerText = "Click Me";
    buttonElement.addEventListener("click", () => {
      console.log('Button in placeholder was clicked')
      });
    });

and passed to the placeholder method worked as expected in version 6.33.0

The same code does not work in version 6.34.0 because the event listener is not copied in version 6.34.0

Please consider making note of this breaking change in the notes for version 6.34.0 and adding this detail to the documentation for the placeholder method.

Browser and platform

No response

Reproduction link

No response

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