-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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: use importNode
to clone templates for Firefox
#15272
Conversation
🦋 Changeset detectedLatest commit: 200bb4c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
@@ -48,7 +48,7 @@ export function template(content, flags) { | |||
} | |||
|
|||
var clone = /** @type {TemplateNode} */ ( | |||
use_import_node ? document.importNode(node, true) : node.cloneNode(true) | |||
use_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be on line 28 instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh yeah it might be better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this might be too soon. Is is_firefox
true at this point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh you are right... it's initialized in init_operations
so it might be too soon indeed. I need to check the other usage too
I saw that importNode is supported in all browsers; https://developer.mozilla.org/en-US/docs/Web/API/Document/importNode |
It is, but it's also much slower in Chrome than |
understood. thanks. |
Before submitting the PR, please make sure you do the following
Closes #15268
Follow up to #15141 ...we now use
importNode
in FF (which based on some test i did in that PR seems to actually be faster in FF) andcloneNode
in the rest...this also mean we don't have to do the trick we did forhandle_lazy_img
because it was only an issue in FF.Not sure how to add a test for this.
Also do we have a way to be sure it's not messing with performance in FF?
feat:
,fix:
,chore:
, ordocs:
.packages/svelte/src
, add a changeset (npx changeset
).Tests and linting
pnpm test
and lint the project withpnpm lint