Skip to content

Commit

Permalink
chore: yet another hydration tweak (#11763)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed May 24, 2024
1 parent caab8da commit d946066
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions packages/svelte/src/internal/client/dom/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,17 @@ export function comment() {
* Assign the created (or in hydration mode, traversed) dom elements to the current block
* and insert the elements into the dom (in client mode).
* @param {Text | Comment | Element} anchor
* @param {DocumentFragment | Element | Comment} node
* @param {DocumentFragment | Element} dom
*/
export function append(anchor, node) {
if (!hydrating) {
/** @type {import('#client').Dom} */
const dom =
node.nodeType === 11
? /** @type {import('#client').TemplateNode[]} */ ([...node.childNodes])
: /** @type {Element | Comment} */ (node);
export function append(anchor, dom) {
if (hydrating) return;

var effect = /** @type {import('#client').Effect} */ (current_effect);

/** @type {import('#client').Effect} */ (current_effect).dom = dom;
effect.dom =
dom.nodeType === 11
? /** @type {import('#client').TemplateNode[]} */ ([...dom.childNodes])
: /** @type {Element | Comment} */ (dom);

anchor.before(/** @type {Node} */ (node));
}
anchor.before(/** @type {Node} */ (dom));
}

0 comments on commit d946066

Please sign in to comment.