Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 6.34.0 introduces a breaking change with cloneNode #1519

Open
OldHippie67 opened this issue Feb 6, 2025 · 0 comments
Open

Version 6.34.0 introduces a breaking change with cloneNode #1519

OldHippie67 opened this issue Feb 6, 2025 · 0 comments

Comments

@OldHippie67
Copy link

OldHippie67 commented Feb 6, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant