Skip to content

Conversation

@samarsault
Copy link
Contributor

@samarsault samarsault commented Apr 7, 2023

WebComponents have lifecycle callbacks which can mess up the structure of the page while trying to create a clone. We'd earlier fixed it for connectedCallback and disconnectedCallback in #1185. attributeChangedCallback is called before connectedCallback and can also cause side effects when we clone a node. We solve for this effect by asserting the shallowness of the node cloned in this PR

@samarsault samarsault changed the title DOM Node clone ensure shallow cloneNode ensure shallow clone Apr 7, 2023
@itsjwala itsjwala added the 🐛 bug Something isn't working label Apr 10, 2023
@itsjwala
Copy link
Contributor

This is related to some frameworks causing these callbacks to be triggered, currently patching on our side only seems to be the fastest option. though I'd like DOM APIs to support a parameter in the callback that makes it aware of cloning in general.

@itsjwala itsjwala changed the title cloneNode ensure shallow clone 🐛 cloneNode ensure shallow clone Apr 10, 2023
@itsjwala itsjwala merged commit 18d4b92 into master Apr 10, 2023
@itsjwala itsjwala deleted the shallow-clone branch April 10, 2023 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants