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
* 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));
}

Loading…
Cancel
Save