Skip to content

Commit 7230fbe

Browse files
committed
spread is faster than Array.from
1 parent a008a9b commit 7230fbe

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/svelte/src/internal/client/dom/reconciler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function reconcile_html(target, value, svg) {
9393
content = /** @type {DocumentFragment} */ (/** @type {unknown} */ (content.firstChild));
9494
}
9595
var clone = content.cloneNode(true);
96-
frag_nodes = Array.from(clone.childNodes);
96+
frag_nodes = [...clone.childNodes];
9797
frag_nodes.forEach((node) => {
9898
target.before(node);
9999
});

packages/svelte/src/internal/client/dom/template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ function close_template(dom, is_fragment, anchor) {
182182
if (is_fragment) {
183183
// if hydrating, `dom` is already an array of nodes, but if not then
184184
// we need to create an array to store it on the current effect
185-
dom = /** @type {import('#client').Dom} */ (Array.from(/** @type {Node} */ (dom).childNodes));
185+
dom = /** @type {import('#client').Dom} */ ([.../** @type {Node} */ (dom).childNodes]);
186186
}
187187

188188
if (anchor !== null) {

0 commit comments

Comments
 (0)