chore: yet another hydration tweak (#11763)

pull/11766/head
Rich Harris 7 months ago committed by GitHub
parent caab8dad05
commit d946066c08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -209,18 +209,17 @@ export function comment() {
* Assign the created (or in hydration mode, traversed) dom elements to the current block * Assign the created (or in hydration mode, traversed) dom elements to the current block
* and insert the elements into the dom (in client mode). * and insert the elements into the dom (in client mode).
* @param {Text | Comment | Element} anchor * @param {Text | Comment | Element} anchor
* @param {DocumentFragment | Element | Comment} node * @param {DocumentFragment | Element} dom
*/ */
export function append(anchor, node) { export function append(anchor, dom) {
if (!hydrating) { if (hydrating) return;
/** @type {import('#client').Dom} */
const dom = var effect = /** @type {import('#client').Effect} */ (current_effect);
node.nodeType === 11
? /** @type {import('#client').TemplateNode[]} */ ([...node.childNodes])
: /** @type {Element | Comment} */ (node);
/** @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));
}
} }

Loading…
Cancel
Save