fix use-directives called multiple times (#4693)

pull/4781/head
Christian Heine 5 years ago
parent c743e72a1e
commit 6cd0921b1e

@ -295,7 +295,7 @@ export default class Block {
if (this.chunks.mount.length === 0) {
properties.mount = noop;
} else if (this.event_listeners.length === 0) {
properties.mount = x`function #mount(#target, #anchor) {
properties.mount = x`function #mount(#target, #anchor, #remount) {
${this.chunks.mount}
}`;
} else {
@ -484,4 +484,4 @@ export default class Block {
}
}
}
}
}

@ -205,7 +205,7 @@ export default class AwaitBlockWrapper extends Wrapper {
const has_transitions = this.pending.block.has_intro_method || this.pending.block.has_outro_method;
block.chunks.mount.push(b`
${info}.block.m(${initial_mount_node}, ${info}.anchor = ${anchor_node});
${info}.block.m(${initial_mount_node}, ${info}.anchor = ${anchor_node}, #remount);
${info}.mount = () => ${update_mount_node};
${info}.anchor = ${anchor};
`);

@ -294,7 +294,7 @@ export default class EachBlockWrapper extends Wrapper {
block.chunks.mount.push(b`
if (${each_block_else}) {
${each_block_else}.m(${initial_mount_node}, ${initial_anchor_node});
${each_block_else}.m(${initial_mount_node}, ${initial_anchor_node}, #remount);
}
`);
@ -417,7 +417,7 @@ export default class EachBlockWrapper extends Wrapper {
block.chunks.mount.push(b`
for (let #i = 0; #i < ${view_length}; #i += 1) {
${iterations}[#i].m(${initial_mount_node}, ${initial_anchor_node});
${iterations}[#i].m(${initial_mount_node}, ${initial_anchor_node}, #remount);
}
`);
@ -509,7 +509,7 @@ export default class EachBlockWrapper extends Wrapper {
block.chunks.mount.push(b`
for (let #i = 0; #i < ${view_length}; #i += 1) {
${iterations}[#i].m(${initial_mount_node}, ${initial_anchor_node});
${iterations}[#i].m(${initial_mount_node}, ${initial_anchor_node}, #remount);
}
`);

@ -297,11 +297,11 @@ export default class IfBlockWrapper extends Wrapper {
if (if_exists_condition) {
block.chunks.mount.push(
b`if (${if_exists_condition}) ${name}.m(${initial_mount_node}, ${anchor_node});`
b`if (${if_exists_condition}) ${name}.m(${initial_mount_node}, ${anchor_node}, #remount);`
);
} else {
block.chunks.mount.push(
b`${name}.m(${initial_mount_node}, ${anchor_node});`
b`${name}.m(${initial_mount_node}, ${anchor_node}, #remount);`
);
}
@ -427,7 +427,7 @@ export default class IfBlockWrapper extends Wrapper {
block.chunks.mount.push(
if_current_block_type_index(
b`${if_blocks}[${current_block_type_index}].m(${initial_mount_node}, ${anchor_node});`
b`${if_blocks}[${current_block_type_index}].m(${initial_mount_node}, ${anchor_node}, #remount);`
)
);
@ -522,7 +522,7 @@ export default class IfBlockWrapper extends Wrapper {
const anchor_node = parent_node ? 'null' : '#anchor';
block.chunks.mount.push(
b`if (${name}) ${name}.m(${initial_mount_node}, ${anchor_node});`
b`if (${name}) ${name}.m(${initial_mount_node}, ${anchor_node}, #remount);`
);
if (branch.dependencies.length > 0) {

@ -435,7 +435,7 @@ export default class InlineComponentWrapper extends Wrapper {
block.chunks.mount.push(b`
if (${name}) {
@mount_component(${name}, ${parent_node || '#target'}, ${parent_node ? 'null' : '#anchor'});
@mount_component(${name}, ${parent_node || '#target'}, ${parent_node ? 'null' : '#anchor'}, #remount);
}
`);
@ -509,7 +509,7 @@ export default class InlineComponentWrapper extends Wrapper {
}
block.chunks.mount.push(
b`@mount_component(${name}, ${parent_node || '#target'}, ${parent_node ? 'null' : '#anchor'});`
b`@mount_component(${name}, ${parent_node || '#target'}, ${parent_node ? 'null' : '#anchor'}, #remount);`
);
block.chunks.intro.push(b`

@ -52,10 +52,10 @@ export function claim_component(block, parent_nodes) {
block && block.l(parent_nodes);
}
export function mount_component(component, target, anchor) {
export function mount_component(component, target, anchor, remount=false) {
const { fragment, on_mount, on_destroy, after_update } = component.$$;
fragment && fragment.m(target, anchor);
fragment && fragment.m(target, anchor, remount);
// onMount happens before the initial afterUpdate
add_render_callback(() => {

@ -21,7 +21,7 @@ function create_fragment(ctx) {
div.textContent = "some content";
add_render_callback(() => /*div_elementresize_handler*/ ctx[2].call(div));
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, div, anchor);
div_resize_listener = add_resize_listener(div, /*div_elementresize_handler*/ ctx[2].bind(div));
},
@ -61,4 +61,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -53,7 +53,7 @@ function create_fragment(ctx) {
l: function claim(nodes) {
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
},
m: function mount(target, anchor) {
m: function mount(target, anchor, remount) {
insert_dev(target, p, anchor);
append_dev(p, t0);
append_dev(p, t1);
@ -198,4 +198,4 @@ class Component extends SvelteComponentDev {
}
export default Component;
export { moduleLiveBinding, moduleContantProps };
export { moduleLiveBinding, moduleContantProps };

@ -30,7 +30,7 @@ function create_fragment(ctx) {
t = text(/*foo*/ ctx[0]);
attr(p, "class", "svelte-1a7i8ec");
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, p, anchor);
append(p, t);
},
@ -63,4 +63,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -19,8 +19,8 @@ function create_fragment(ctx) {
c() {
create_component(nested.$$.fragment);
},
m(target, anchor) {
mount_component(nested, target, anchor);
m(target, anchor, remount) {
mount_component(nested, target, anchor, remount);
current = true;
},
p: noop,
@ -51,4 +51,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -19,8 +19,8 @@ function create_fragment(ctx) {
c() {
create_component(nested.$$.fragment);
},
m(target, anchor) {
mount_component(nested, target, anchor);
m(target, anchor, remount) {
mount_component(nested, target, anchor, remount);
current = true;
},
p: noop,
@ -51,4 +51,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -19,8 +19,8 @@ function create_fragment(ctx) {
c() {
create_component(nested.$$.fragment);
},
m(target, anchor) {
mount_component(nested, target, anchor);
m(target, anchor, remount) {
mount_component(nested, target, anchor, remount);
current = true;
},
p: noop,
@ -51,4 +51,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -37,9 +37,9 @@ function create_fragment(ctx) {
input = element("input");
},
m(target, anchor, remount) {
mount_component(foo, target, anchor);
mount_component(foo, target, anchor, remount);
insert(target, t0, anchor);
mount_component(bar, target, anchor);
mount_component(bar, target, anchor, remount);
insert(target, t1, anchor);
insert(target, input, anchor);
set_input_value(input, /*z*/ ctx[0]);
@ -98,4 +98,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -19,8 +19,8 @@ function create_fragment(ctx) {
c() {
create_component(nested.$$.fragment);
},
m(target, anchor) {
mount_component(nested, target, anchor);
m(target, anchor, remount) {
mount_component(nested, target, anchor, remount);
current = true;
},
p: noop,
@ -51,4 +51,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -24,7 +24,7 @@ function create_fragment(ctx) {
h1 = element("h1");
t = text(/*$foo*/ ctx[0]);
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, h1, anchor);
append(h1, t);
},
@ -53,4 +53,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -26,7 +26,7 @@ function create_fragment(ctx) {
div = element("div");
attr(div, "class", "svelte-1slhpfn");
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, div, anchor);
},
p: noop,
@ -46,4 +46,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -18,7 +18,7 @@ function create_fragment(ctx) {
div.textContent = "fades in";
this.c = noop;
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, div, anchor);
},
p: noop,
@ -45,4 +45,4 @@ class Component extends SvelteElement {
}
customElements.define("custom-element", Component);
export default Component;
export default Component;

@ -24,7 +24,7 @@ function create_fragment(ctx) {
attr(div0, "data-foo", "bar");
attr(div1, "data-foo", /*bar*/ ctx[0]);
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, div0, anchor);
insert(target, t, anchor);
insert(target, div1, anchor);
@ -61,4 +61,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -38,7 +38,7 @@ function create_fragment(ctx) {
l: function claim(nodes) {
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
},
m: function mount(target, anchor) {
m: function mount(target, anchor, remount) {
insert_dev(target, h1, anchor);
append_dev(h1, t0);
append_dev(h1, t1);
@ -125,4 +125,4 @@ class Component extends SvelteComponentDev {
}
}
export default Component;
export default Component;

@ -50,7 +50,7 @@ function create_each_block(ctx) {
add_location(span, file, 8, 1, 116);
},
m: function mount(target, anchor) {
m: function mount(target, anchor, remount) {
insert_dev(target, span, anchor);
append_dev(span, t0);
insert_dev(target, t1, anchor);
@ -112,9 +112,9 @@ function create_fragment(ctx) {
l: function claim(nodes) {
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
},
m: function mount(target, anchor) {
m: function mount(target, anchor, remount) {
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(target, anchor);
each_blocks[i].m(target, anchor, remount);
}
insert_dev(target, t0, anchor);
@ -271,4 +271,4 @@ class Component extends SvelteComponentDev {
}
}
export default Component;
export default Component;

@ -47,7 +47,7 @@ function create_each_block(ctx) {
add_location(span, file, 6, 1, 82);
},
m: function mount(target, anchor) {
m: function mount(target, anchor, remount) {
insert_dev(target, span, anchor);
append_dev(span, t0);
insert_dev(target, t1, anchor);
@ -106,9 +106,9 @@ function create_fragment(ctx) {
l: function claim(nodes) {
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
},
m: function mount(target, anchor) {
m: function mount(target, anchor, remount) {
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(target, anchor);
each_blocks[i].m(target, anchor, remount);
}
insert_dev(target, t0, anchor);
@ -235,4 +235,4 @@ class Component extends SvelteComponentDev {
}
}
export default Component;
export default Component;

@ -41,7 +41,7 @@ function create_each_block(ctx) {
t0 = space();
t1 = text(t1_value);
},
m: function mount(target, anchor) {
m: function mount(target, anchor, remount) {
insert_dev(target, t0, anchor);
insert_dev(target, t1, anchor);
},
@ -84,9 +84,9 @@ function create_fragment(ctx) {
l: function claim(nodes) {
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
},
m: function mount(target, anchor) {
m: function mount(target, anchor, remount) {
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(target, anchor);
each_blocks[i].m(target, anchor, remount);
}
insert_dev(target, each_1_anchor, anchor);
@ -161,4 +161,4 @@ class Component extends SvelteComponentDev {
}
}
export default Component;
export default Component;

@ -31,7 +31,7 @@ function create_each_block(ctx) {
span = element("span");
t = text(t_value);
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, span, anchor);
append(span, t);
},
@ -61,9 +61,9 @@ function create_fragment(ctx) {
each_1_anchor = empty();
},
m(target, anchor) {
m(target, anchor, remount) {
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(target, anchor);
each_blocks[i].m(target, anchor, remount);
}
insert(target, each_1_anchor, anchor);
@ -118,4 +118,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -36,7 +36,7 @@ function create_fragment(ctx) {
l: function claim(nodes) {
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
},
m: function mount(target, anchor) {
m: function mount(target, anchor, remount) {
insert_dev(target, p, anchor);
append_dev(p, t0);
append_dev(p, t1);
@ -129,4 +129,4 @@ class Component extends SvelteComponentDev {
}
}
export default Component;
export default Component;

@ -21,8 +21,8 @@ function create_fragment(ctx) {
c() {
create_component(lazyload.$$.fragment);
},
m(target, anchor) {
mount_component(lazyload, target, anchor);
m(target, anchor, remount) {
mount_component(lazyload, target, anchor, remount);
current = true;
},
p: noop,
@ -50,4 +50,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -31,7 +31,7 @@ function create_each_block(ctx) {
span = element("span");
t = text(t_value);
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, span, anchor);
append(span, t);
},
@ -61,9 +61,9 @@ function create_fragment(ctx) {
each_1_anchor = empty();
},
m(target, anchor) {
m(target, anchor, remount) {
for (let i = 0; i < 5; i += 1) {
each_blocks[i].m(target, anchor);
each_blocks[i].m(target, anchor, remount);
}
insert(target, each_1_anchor, anchor);
@ -124,4 +124,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -56,7 +56,7 @@ function create_each_block(ctx) {
html_tag = new HtmlTag(raw_value, null);
attr(div, "class", "comment");
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, div, anchor);
append(div, strong);
append(strong, t0);
@ -101,9 +101,9 @@ function create_fragment(ctx) {
p = element("p");
t1 = text(/*foo*/ ctx[3]);
},
m(target, anchor) {
m(target, anchor, remount) {
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(target, anchor);
each_blocks[i].m(target, anchor, remount);
}
insert(target, t0, anchor);
@ -169,4 +169,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -39,7 +39,7 @@ function create_each_block(key_1, ctx) {
t = text(t_value);
this.first = div;
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, div, anchor);
append(div, t);
},
@ -84,9 +84,9 @@ function create_fragment(ctx) {
each_1_anchor = empty();
},
m(target, anchor) {
m(target, anchor, remount) {
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(target, anchor);
each_blocks[i].m(target, anchor, remount);
}
insert(target, each_1_anchor, anchor);
@ -142,4 +142,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -35,7 +35,7 @@ function create_each_block(key_1, ctx) {
t = text(t_value);
this.first = div;
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, div, anchor);
append(div, t);
},
@ -69,9 +69,9 @@ function create_fragment(ctx) {
each_1_anchor = empty();
},
m(target, anchor) {
m(target, anchor, remount) {
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].m(target, anchor);
each_blocks[i].m(target, anchor, remount);
}
insert(target, each_1_anchor, anchor);
@ -111,4 +111,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -23,7 +23,7 @@ function create_fragment(ctx) {
attr(meta1, "name", "twitter:title");
attr(meta1, "content", "Svelte");
},
m(target, anchor) {
m(target, anchor, remount) {
append(document.head, meta0);
append(document.head, meta1);
},
@ -44,4 +44,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -17,7 +17,7 @@ function create_fragment(ctx) {
b = element("b");
b.textContent = `${get_answer()}`;
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, b, anchor);
},
p: noop,
@ -42,4 +42,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -17,7 +17,7 @@ function create_fragment(ctx) {
b = element("b");
b.textContent = `${get_answer()}`;
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, b, anchor);
},
p: noop,
@ -42,4 +42,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -38,7 +38,7 @@ function create_fragment(ctx) {
if (img.src !== (img_src_value = "donuts.jpg")) attr(img, "src", img_src_value);
attr(img, "alt", "donuts");
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, img, anchor);
insert(target, t, anchor);
insert(target, div, anchor);
@ -61,4 +61,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -19,7 +19,7 @@ function create_if_block(ctx) {
div = element("div");
attr(div, "class", "divider");
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, div, anchor);
},
d(detaching) {
@ -38,8 +38,8 @@ function create_fragment(ctx) {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
m(target, anchor, remount) {
if (if_block) if_block.m(target, anchor, remount);
insert(target, if_block_anchor, anchor);
},
p: noop,
@ -64,4 +64,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -18,7 +18,7 @@ function create_else_block(ctx) {
p = element("p");
p.textContent = "not foo!";
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, p, anchor);
},
d(detaching) {
@ -36,7 +36,7 @@ function create_if_block(ctx) {
p = element("p");
p.textContent = "foo!";
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, p, anchor);
},
d(detaching) {
@ -61,8 +61,8 @@ function create_fragment(ctx) {
if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if_block.m(target, anchor);
m(target, anchor, remount) {
if_block.m(target, anchor, remount);
insert(target, if_block_anchor, anchor);
},
p(ctx, [dirty]) {
@ -102,4 +102,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -18,7 +18,7 @@ function create_if_block(ctx) {
p = element("p");
p.textContent = "foo!";
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, p, anchor);
},
d(detaching) {
@ -36,14 +36,14 @@ function create_fragment(ctx) {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
m(target, anchor, remount) {
if (if_block) if_block.m(target, anchor, remount);
insert(target, if_block_anchor, anchor);
},
p(ctx, [dirty]) {
if (/*foo*/ ctx[0]) {
if (if_block) {
} else {
if_block = create_if_block(ctx);
if_block.c();
@ -80,4 +80,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -19,7 +19,7 @@ function create_fragment(ctx) {
set_style(div, "color", /*color*/ ctx[0]);
set_style(div, "transform", "translate(" + /*x*/ ctx[1] + "px," + /*y*/ ctx[2] + "px)");
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, div, anchor);
},
p(ctx, [dirty]) {
@ -60,4 +60,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -18,7 +18,7 @@ function create_fragment(ctx) {
div = element("div");
set_style(div, "background", "url(data:image/png;base64," + /*data*/ ctx[0] + ")");
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, div, anchor);
},
p(ctx, [dirty]) {
@ -51,4 +51,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -18,7 +18,7 @@ function create_fragment(ctx) {
div = element("div");
set_style(div, "color", /*color*/ ctx[0]);
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, div, anchor);
},
p(ctx, [dirty]) {
@ -51,4 +51,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -25,7 +25,7 @@ function create_fragment(ctx) {
attr(div0, "style", /*style*/ ctx[0]);
attr(div1, "style", div1_style_value = "" + (/*key*/ ctx[1] + ": " + /*value*/ ctx[2]));
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, div0, anchor);
insert(target, t, anchor);
insert(target, div1, anchor);
@ -70,4 +70,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -18,7 +18,7 @@ function create_fragment(ctx) {
div = element("div");
set_style(div, "color", color);
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, div, anchor);
},
p: noop,
@ -39,4 +39,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -23,7 +23,7 @@ function create_fragment(ctx) {
t0 = text("x: ");
t1 = text(/*x*/ ctx[0]);
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, p, anchor);
append(p, t0);
append(p, t1);
@ -72,4 +72,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -18,7 +18,7 @@ function create_fragment(ctx) {
input = element("input");
set_input_type(input, "search");
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, input, anchor);
},
p: noop,
@ -37,4 +37,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -29,7 +29,7 @@ function create_fragment(ctx) {
l: function claim(nodes) {
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
},
m: function mount(target, anchor) {
m: function mount(target, anchor, remount) {
insert_dev(target, div, anchor);
/*div_binding*/ ctx[1](div);
},
@ -165,4 +165,4 @@ class Component extends SvelteComponentDev {
}
}
export default Component;
export default Component;

@ -28,10 +28,10 @@ function create_fragment(ctx) {
t = space();
create_component(nonimported.$$.fragment);
},
m(target, anchor) {
mount_component(imported, target, anchor);
m(target, anchor, remount) {
mount_component(imported, target, anchor, remount);
insert(target, t, anchor);
mount_component(nonimported, target, anchor);
mount_component(nonimported, target, anchor, remount);
current = true;
},
p: noop,
@ -61,4 +61,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -17,7 +17,7 @@ function create_fragment(ctx) {
h1 = element("h1");
h1.textContent = `Hello ${name}!`;
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, h1, anchor);
},
p: noop,
@ -38,4 +38,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -28,7 +28,7 @@ function create_fragment(ctx) {
option1.__value = "2";
option1.value = option1.__value;
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, select, anchor);
append(select, option0);
append(select, option1);
@ -80,4 +80,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -39,7 +39,7 @@ function create_fragment(ctx) {
attr(img1, "alt", "potato");
if (img1.src !== (img1_src_value = "" + (/*slug*/ ctx[1] + ".jpg"))) attr(img1, "src", img1_src_value);
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, img0, anchor);
insert(target, t, anchor);
insert(target, img1, anchor);
@ -82,4 +82,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -22,7 +22,7 @@ function create_fragment(ctx) {
title = svg_element("title");
t = text("a title");
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, svg, anchor);
append(svg, title);
append(title, t);
@ -43,4 +43,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -22,8 +22,8 @@ function create_if_block(ctx) {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
m(target, anchor, remount) {
if (if_block) if_block.m(target, anchor, remount);
insert(target, if_block_anchor, anchor);
},
p(ctx, dirty) {
@ -60,7 +60,7 @@ function create_if_block_1(ctx) {
div = element("div");
div.textContent = "...";
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, div, anchor);
},
i(local) {
@ -89,8 +89,8 @@ function create_fragment(ctx) {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
m(target, anchor, remount) {
if (if_block) if_block.m(target, anchor, remount);
insert(target, if_block_anchor, anchor);
},
p(ctx, [dirty]) {
@ -117,7 +117,7 @@ function create_fragment(ctx) {
}
function foo() {
}
function instance($$self, $$props, $$invalidate) {
@ -139,4 +139,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -26,7 +26,7 @@ function create_if_block(ctx) {
div = element("div");
div.innerHTML = `<p>wheeee</p>`;
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, div, anchor);
current = true;
},
@ -56,8 +56,8 @@ function create_fragment(ctx) {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
m(target, anchor, remount) {
if (if_block) if_block.m(target, anchor, remount);
insert(target, if_block_anchor, anchor);
current = true;
},
@ -116,4 +116,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -43,7 +43,7 @@ function create_fragment(ctx) {
t8 = text("Hello ");
t9 = text(/*world3*/ ctx[0]);
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, div0, anchor);
append(div0, p0);
append(div0, t1);
@ -89,4 +89,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -23,7 +23,7 @@ function create_fragment(ctx) {
p = element("p");
t = text(/*y*/ ctx[0]);
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, p, anchor);
append(p, t);
},
@ -74,4 +74,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -20,7 +20,7 @@ function create_if_block_4(ctx) {
p = element("p");
p.textContent = "a";
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, p, anchor);
},
d(detaching) {
@ -38,7 +38,7 @@ function create_if_block_3(ctx) {
p = element("p");
p.textContent = "b";
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, p, anchor);
},
d(detaching) {
@ -56,7 +56,7 @@ function create_if_block_2(ctx) {
p = element("p");
p.textContent = "c";
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, p, anchor);
},
d(detaching) {
@ -74,7 +74,7 @@ function create_if_block_1(ctx) {
p = element("p");
p.textContent = "d";
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, p, anchor);
},
d(detaching) {
@ -92,7 +92,7 @@ function create_if_block(ctx) {
p = element("p");
p.textContent = "e";
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, p, anchor);
},
d(detaching) {
@ -138,27 +138,27 @@ function create_fragment(ctx) {
if (if_block4) if_block4.c();
if_block4_anchor = empty();
},
m(target, anchor) {
m(target, anchor, remount) {
insert(target, div, anchor);
if (if_block0) if_block0.m(div, null);
if (if_block0) if_block0.m(div, null, remount);
append(div, t0);
append(div, p0);
append(div, t2);
if (if_block1) if_block1.m(div, null);
if (if_block1) if_block1.m(div, null, remount);
append(div, t3);
if (if_block2) if_block2.m(div, null);
if (if_block2) if_block2.m(div, null, remount);
append(div, t4);
append(div, p1);
append(div, t6);
if (if_block3) if_block3.m(div, null);
if (if_block3) if_block3.m(div, null, remount);
insert(target, t7, anchor);
if (if_block4) if_block4.m(target, anchor);
if (if_block4) if_block4.m(target, anchor, remount);
insert(target, if_block4_anchor, anchor);
},
p(ctx, [dirty]) {
if (/*a*/ ctx[0]) {
if (if_block0) {
} else {
if_block0 = create_if_block_4(ctx);
if_block0.c();
@ -171,7 +171,7 @@ function create_fragment(ctx) {
if (/*b*/ ctx[1]) {
if (if_block1) {
} else {
if_block1 = create_if_block_3(ctx);
if_block1.c();
@ -184,7 +184,7 @@ function create_fragment(ctx) {
if (/*c*/ ctx[2]) {
if (if_block2) {
} else {
if_block2 = create_if_block_2(ctx);
if_block2.c();
@ -197,7 +197,7 @@ function create_fragment(ctx) {
if (/*d*/ ctx[3]) {
if (if_block3) {
} else {
if_block3 = create_if_block_1(ctx);
if_block3.c();
@ -210,7 +210,7 @@ function create_fragment(ctx) {
if (/*e*/ ctx[4]) {
if (if_block4) {
} else {
if_block4 = create_if_block(ctx);
if_block4.c();
@ -261,4 +261,4 @@ class Component extends SvelteComponent {
}
}
export default Component;
export default Component;

@ -0,0 +1,5 @@
<script>
export let action;
</script>
<div use:action />

@ -0,0 +1,21 @@
export default {
test({ assert, component, raf }) {
assert.equal(component.count, 0);
component.arr = ["2"];
assert.equal(component.count, 1);
component.arr = ["1", "2"];
assert.equal(component.count, 2);
component.arr = ["2", "1"];
assert.equal(component.count, 2);
component.arr = [];
assert.equal(component.count, 0);
},
};

@ -0,0 +1,17 @@
<script>
import Component from "./Component.svelte";
export let arr = [];
export let count = 0;
function action(node, params) {
count += 1;
return {
destroy() {
count -= 1;
}
};
}
</script>
{#each arr as item (item)}
<Component {action} />
{/each}
Loading…
Cancel
Save