diff --git a/src/generators/dom/visitors/EachBlock.ts b/src/generators/dom/visitors/EachBlock.ts index 330dba6b81..a17285a8d2 100644 --- a/src/generators/dom/visitors/EachBlock.ts +++ b/src/generators/dom/visitors/EachBlock.ts @@ -122,7 +122,7 @@ export default function visitEachBlock( ); block.builders.destroy.addBlock(deindent` - if (${each_block_else}) ${each_block_else}.destroy(false); + if (${each_block_else}) ${each_block_else}.destroy(); `); } @@ -351,7 +351,7 @@ function keyed( block.builders.destroy.addBlock(deindent` var ${iteration} = ${head}; while (${iteration}) { - ${iteration}.destroy(false); + ${iteration}.destroy(); ${iteration} = ${iteration}.next; } `); @@ -486,5 +486,5 @@ function unkeyed( } `); - block.builders.destroy.addBlock(`@destroyEach(${iterations}, false, 0);`); + block.builders.destroy.addBlock(`@destroyEach(${iterations});`); } diff --git a/src/shared/dom.js b/src/shared/dom.js index ffbda89b6d..bae9ed86c4 100644 --- a/src/shared/dom.js +++ b/src/shared/dom.js @@ -47,10 +47,9 @@ export function reinsertBefore(after, target) { while (parent.firstChild !== after) target.appendChild(parent.firstChild); } -// TODO this is out of date -export function destroyEach(iterations, detach, start) { - for (var i = start; i < iterations.length; i += 1) { - if (iterations[i]) iterations[i].destroy(detach); +export function destroyEach(iterations) { + for (var i = 0; i < iterations.length; i += 1) { + if (iterations[i]) iterations[i].destroy(); } } diff --git a/test/js/samples/each-block-changed-check/expected-bundle.js b/test/js/samples/each-block-changed-check/expected-bundle.js index e26de86305..fdb4100a92 100644 --- a/test/js/samples/each-block-changed-check/expected-bundle.js +++ b/test/js/samples/each-block-changed-check/expected-bundle.js @@ -31,10 +31,9 @@ function detachAfter(before) { } } -// TODO this is out of date -function destroyEach(iterations, detach, start) { - for (var i = start; i < iterations.length; i += 1) { - if (iterations[i]) iterations[i].destroy(detach); +function destroyEach(iterations) { + for (var i = 0; i < iterations.length; i += 1) { + if (iterations[i]) iterations[i].destroy(); } } @@ -268,7 +267,7 @@ function create_main_fragment(state, component) { }, destroy: function() { - destroyEach(each_blocks, false, 0); + destroyEach(each_blocks); } }; } diff --git a/test/js/samples/each-block-changed-check/expected.js b/test/js/samples/each-block-changed-check/expected.js index efc1bfd1dd..d7bc0e680b 100644 --- a/test/js/samples/each-block-changed-check/expected.js +++ b/test/js/samples/each-block-changed-check/expected.js @@ -70,7 +70,7 @@ function create_main_fragment(state, component) { }, destroy: function() { - destroyEach(each_blocks, false, 0); + destroyEach(each_blocks); } }; }