Skip to content

Commit 42f3c92

Browse files
committed
avoid reassigning argument
1 parent 7230fbe commit 42f3c92

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,22 +178,24 @@ export function comment(anchor) {
178178
* @returns {import('#client').Dom}
179179
*/
180180
function close_template(dom, is_fragment, anchor) {
181+
var current = dom;
182+
181183
if (!hydrating) {
182184
if (is_fragment) {
183185
// if hydrating, `dom` is already an array of nodes, but if not then
184186
// we need to create an array to store it on the current effect
185-
dom = /** @type {import('#client').Dom} */ ([.../** @type {Node} */ (dom).childNodes]);
187+
current = /** @type {import('#client').Dom} */ ([.../** @type {Node} */ (dom).childNodes]);
186188
}
187189

188190
if (anchor !== null) {
189191
// TODO as with `open_template — why is this sometimes null and sometimes not?
190-
insert(dom, anchor);
192+
insert(current, anchor);
191193
}
192194
}
193195

194-
/** @type {import('#client').Effect} */ (current_effect).dom = dom;
196+
/** @type {import('#client').Effect} */ (current_effect).dom = current;
195197

196-
return dom;
198+
return current;
197199
}
198200

199201
/**

0 commit comments

Comments
 (0)