only run render effect for children of non-void <svelte:element> #10884
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I don't know if this is a good idea or not, but I encountered it while looking at the
hydrate_block_anchor
function:svelte/packages/svelte/src/internal/client/dom/hydration.js
Lines 79 to 98 in fe7c45b
In all but 5 tests,
anchor
is aComment
. 3 of those tests relate to this......and if we can avoid creating the children for these elements then there'll only be 2 tests where
anchor
isn't aComment
, and if we can figure out those edge cases then maybe we can simplify that function by enforcing that its argument is always aComment
. Fewerif
branches makes everything more understandable, and every microsecond counts during hydration.It turns out we can determine which elements are void by checking to see if
element.outerHTML
contains a solidus (/
). Admittedly, this trades work in one place for work in another. Just putting it up for discussion for now.