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

fix: always use document.importNode for template cloning #11592

Closed
wants to merge 2 commits into from

Conversation

trueadm
Copy link
Contributor

@trueadm trueadm commented May 13, 2024

Fixes #11589. It's a shame we can't use Node.prototype.cloneNode because it generally offers better performance, but at the tradeoff with issues around FF and lazy images, not to mention shadow DOM and custom elements.

In terms of overhead, cloneNode is about 30% faster than importNode in my local testing.

Additional Context: solidjs/solid#1828

Copy link

changeset-bot bot commented May 13, 2024

🦋 Changeset detected

Latest commit: a659ef2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@trueadm
Copy link
Contributor Author

trueadm commented May 13, 2024

The big question is if we're happy with the trade-offs of the performance loss. Can we address lazy images another way for FF?

@trueadm trueadm closed this May 13, 2024
@trueadm trueadm deleted the use-import-node branch May 13, 2024 17:33
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

Successfully merging this pull request may close these issues.

Svelte 5: <img loading="lazy"> loads eagerly in Firefox (part 2)
1 participant