add note, simplify

pull/10891/head
Rich Harris 2 years ago
parent e18e5d2208
commit 90310081f5

@ -111,19 +111,18 @@ export function element(anchor, get_tag, is_svg, render_fn) {
: document.createElement(next_tag); : document.createElement(next_tag);
if (render_fn) { if (render_fn) {
let anchor; // If hydrating, use the existing ssr comment as the anchor so that the
// inner open and close methods can pick up the existing nodes correctly
if (hydrating) { var child_anchor = hydrating
// Use the existing ssr comment as the anchor so that the inner open and close ? /** @type {Comment} */ (element.firstChild)
// methods can pick up the existing nodes correctly : element.appendChild(empty());
anchor = /** @type {Comment} */ (element.firstChild);
} else { if (child_anchor) {
anchor = empty(); // `child_anchor` can be undefined if this is a void element with children,
element.appendChild(anchor); // i.e. `<svelte:element this={"hr"}>...</svelte:element>`. This is
} // user error, but we warn on it elsewhere (in dev) so here we just
// silently ignore it
if (anchor) { render_fn(element, child_anchor);
render_fn(element, anchor);
} }
} }

Loading…
Cancel
Save