fix actions having no access to parent nodes (#4252)

pull/4257/head
Tan Li Hau 5 years ago committed by Conduitry
parent 3d9655a2a1
commit a422d2aba5

@ -4,6 +4,7 @@
* Prevent text input cursor jumping in Safari with one-way binding ([#3449](https://github.com/sveltejs/svelte/issues/3449)) * Prevent text input cursor jumping in Safari with one-way binding ([#3449](https://github.com/sveltejs/svelte/issues/3449))
* Expose compiler version in dev events ([#4047](https://github.com/sveltejs/svelte/issues/4047)) * Expose compiler version in dev events ([#4047](https://github.com/sveltejs/svelte/issues/4047))
* Don't run actions before their element is in the document ([#4166](https://github.com/sveltejs/svelte/issues/4166))
* Fix reactive assignments with destructuring and stores where the destructured value should be undefined ([#4170](https://github.com/sveltejs/svelte/issues/4170)) * Fix reactive assignments with destructuring and stores where the destructured value should be undefined ([#4170](https://github.com/sveltejs/svelte/issues/4170))
* Do not automatically declare variables in reactive declarations when assigning to a member expression ([#4212](https://github.com/sveltejs/svelte/issues/4212)) * Do not automatically declare variables in reactive declarations when assigning to a member expression ([#4212](https://github.com/sveltejs/svelte/issues/4212))

@ -450,7 +450,7 @@ export default class Block {
this.add_variable(dispose); this.add_variable(dispose);
if (this.event_listeners.length === 1) { if (this.event_listeners.length === 1) {
this.chunks.hydrate.push( this.chunks.mount.push(
b`${dispose} = ${this.event_listeners[0]};` b`${dispose} = ${this.event_listeners[0]};`
); );
@ -458,7 +458,7 @@ export default class Block {
b`${dispose}();` b`${dispose}();`
); );
} else { } else {
this.chunks.hydrate.push(b` this.chunks.mount.push(b`
${dispose} = [ ${dispose} = [
${this.event_listeners} ${this.event_listeners}
]; ];

@ -20,10 +20,10 @@ function create_fragment(ctx) {
c() { c() {
button = element("button"); button = element("button");
button.textContent = "foo"; button.textContent = "foo";
dispose = action_destroyer(foo_action = foo.call(null, button, /*foo_function*/ ctx[1]));
}, },
m(target, anchor) { m(target, anchor) {
insert(target, button, anchor); insert(target, button, anchor);
dispose = action_destroyer(foo_action = foo.call(null, button, /*foo_function*/ ctx[1]));
}, },
p(ctx, [dirty]) { p(ctx, [dirty]) {
if (foo_action && is_function(foo_action.update) && dirty & /*bar*/ 1) foo_action.update.call(null, /*foo_function*/ ctx[1]); if (foo_action && is_function(foo_action.update) && dirty & /*bar*/ 1) foo_action.update.call(null, /*foo_function*/ ctx[1]);
@ -42,7 +42,7 @@ function handleFoo(bar) {
} }
function foo(node, callback) { function foo(node, callback) {
} }
function instance($$self, $$props, $$invalidate) { function instance($$self, $$props, $$invalidate) {

@ -21,10 +21,10 @@ function create_fragment(ctx) {
a = element("a"); a = element("a");
a.textContent = "Test"; a.textContent = "Test";
attr(a, "href", "#"); attr(a, "href", "#");
dispose = action_destroyer(link_action = link.call(null, a));
}, },
m(target, anchor) { m(target, anchor) {
insert(target, a, anchor); insert(target, a, anchor);
dispose = action_destroyer(link_action = link.call(null, a));
}, },
p: noop, p: noop,
i: noop, i: noop,

@ -14,13 +14,13 @@ function create_fragment(ctx) {
add_render_callback(/*onlinestatuschanged*/ ctx[1]); add_render_callback(/*onlinestatuschanged*/ ctx[1]);
return { return {
c() { c: noop,
m(target, anchor) {
dispose = [ dispose = [
listen(window, "online", /*onlinestatuschanged*/ ctx[1]), listen(window, "online", /*onlinestatuschanged*/ ctx[1]),
listen(window, "offline", /*onlinestatuschanged*/ ctx[1]) listen(window, "offline", /*onlinestatuschanged*/ ctx[1])
]; ];
}, },
m: noop,
p: noop, p: noop,
i: noop, i: noop,
o: noop, o: noop,

@ -20,12 +20,11 @@ function create_fragment(ctx) {
details.innerHTML = `<summary>summary</summary>content details.innerHTML = `<summary>summary</summary>content
`; `;
dispose = listen(details, "toggle", /*details_toggle_handler*/ ctx[1]);
}, },
m(target, anchor) { m(target, anchor) {
insert(target, details, anchor); insert(target, details, anchor);
details.open = /*open*/ ctx[0]; details.open = /*open*/ ctx[0];
dispose = listen(details, "toggle", /*details_toggle_handler*/ ctx[1]);
}, },
p(ctx, [dirty]) { p(ctx, [dirty]) {
if (dirty & /*open*/ 1) { if (dirty & /*open*/ 1) {

@ -26,16 +26,16 @@ function create_fragment(ctx) {
input1 = element("input"); input1 = element("input");
attr(input0, "type", "file"); attr(input0, "type", "file");
attr(input1, "type", "file"); attr(input1, "type", "file");
dispose = [
listen(input0, "change", /*input0_change_handler*/ ctx[1]),
listen(input1, "change", /*input1_change_handler*/ ctx[2])
];
}, },
m(target, anchor) { m(target, anchor) {
insert(target, input0, anchor); insert(target, input0, anchor);
insert(target, t, anchor); insert(target, t, anchor);
insert(target, input1, anchor); insert(target, input1, anchor);
dispose = [
listen(input0, "change", /*input0_change_handler*/ ctx[1]),
listen(input1, "change", /*input1_change_handler*/ ctx[2])
];
}, },
p: noop, p: noop,
i: noop, i: noop,

@ -28,7 +28,6 @@ function create_fragment(ctx) {
t0 = text(/*foo*/ ctx[0]); t0 = text(/*foo*/ ctx[0]);
t1 = space(); t1 = space();
input = element("input"); input = element("input");
dispose = listen(input, "input", /*input_input_handler*/ ctx[1]);
}, },
m(target, anchor) { m(target, anchor) {
insert(target, p, anchor); insert(target, p, anchor);
@ -36,6 +35,7 @@ function create_fragment(ctx) {
insert(target, t1, anchor); insert(target, t1, anchor);
insert(target, input, anchor); insert(target, input, anchor);
set_input_value(input, /*foo*/ ctx[0]); set_input_value(input, /*foo*/ ctx[0]);
dispose = listen(input, "input", /*input_input_handler*/ ctx[1]);
}, },
p(ctx, [dirty]) { p(ctx, [dirty]) {
if (dirty & /*foo*/ 1) set_data(t0, /*foo*/ ctx[0]); if (dirty & /*foo*/ 1) set_data(t0, /*foo*/ ctx[0]);

@ -35,7 +35,6 @@ function create_fragment(ctx) {
create_component(bar.$$.fragment); create_component(bar.$$.fragment);
t1 = space(); t1 = space();
input = element("input"); input = element("input");
dispose = listen(input, "input", /*input_input_handler*/ ctx[1]);
}, },
m(target, anchor) { m(target, anchor) {
mount_component(foo, target, anchor); mount_component(foo, target, anchor);
@ -45,6 +44,7 @@ function create_fragment(ctx) {
insert(target, input, anchor); insert(target, input, anchor);
set_input_value(input, /*z*/ ctx[0]); set_input_value(input, /*z*/ ctx[0]);
current = true; current = true;
dispose = listen(input, "input", /*input_input_handler*/ ctx[1]);
}, },
p(ctx, [dirty]) { p(ctx, [dirty]) {
const bar_changes = {}; const bar_changes = {};

@ -31,13 +31,13 @@ function create_fragment(ctx) {
t1 = space(); t1 = space();
button = element("button"); button = element("button");
button.textContent = "reset"; button.textContent = "reset";
dispose = listen(button, "click", /*click_handler*/ ctx[2]);
}, },
m(target, anchor) { m(target, anchor) {
insert(target, h1, anchor); insert(target, h1, anchor);
append(h1, t0); append(h1, t0);
insert(target, t1, anchor); insert(target, t1, anchor);
insert(target, button, anchor); insert(target, button, anchor);
dispose = listen(button, "click", /*click_handler*/ ctx[2]);
}, },
p(ctx, [dirty]) { p(ctx, [dirty]) {
if (dirty & /*$foo*/ 2) set_data(t0, /*$foo*/ ctx[1]); if (dirty & /*$foo*/ 2) set_data(t0, /*$foo*/ ctx[1]);

@ -17,10 +17,10 @@ function create_fragment(ctx) {
return { return {
c() { c() {
input = element("input"); input = element("input");
dispose = listen(input, "input", make_uppercase);
}, },
m(target, anchor) { m(target, anchor) {
insert(target, input, anchor); insert(target, input, anchor);
dispose = listen(input, "input", make_uppercase);
}, },
p: noop, p: noop,
i: noop, i: noop,

@ -42,14 +42,6 @@ function create_fragment(ctx) {
t5 = space(); t5 = space();
button2 = element("button"); button2 = element("button");
button2.textContent = "click"; button2.textContent = "click";
dispose = [
listen(button0, "click", /*updateHandler1*/ ctx[2]),
listen(button1, "click", /*updateHandler2*/ ctx[3]),
listen(button2, "click", function () {
if (is_function(/*clickHandler*/ ctx[0])) /*clickHandler*/ ctx[0].apply(this, arguments);
})
];
}, },
m(target, anchor) { m(target, anchor) {
insert(target, p0, anchor); insert(target, p0, anchor);
@ -61,6 +53,14 @@ function create_fragment(ctx) {
append(p1, t4); append(p1, t4);
insert(target, t5, anchor); insert(target, t5, anchor);
insert(target, button2, anchor); insert(target, button2, anchor);
dispose = [
listen(button0, "click", /*updateHandler1*/ ctx[2]),
listen(button1, "click", /*updateHandler2*/ ctx[3]),
listen(button2, "click", function () {
if (is_function(/*clickHandler*/ ctx[0])) /*clickHandler*/ ctx[0].apply(this, arguments);
})
];
}, },
p(new_ctx, [dirty]) { p(new_ctx, [dirty]) {
ctx = new_ctx; ctx = new_ctx;

@ -20,10 +20,10 @@ function create_fragment(ctx) {
a = element("a"); a = element("a");
a.textContent = "this should not navigate to example.com"; a.textContent = "this should not navigate to example.com";
attr(a, "href", "https://example.com"); attr(a, "href", "https://example.com");
dispose = listen(a, "touchstart", touchstart_handler);
}, },
m(target, anchor) { m(target, anchor) {
insert(target, a, anchor); insert(target, a, anchor);
dispose = listen(a, "touchstart", touchstart_handler);
}, },
p: noop, p: noop,
i: noop, i: noop,

@ -35,13 +35,6 @@ function create_fragment(ctx) {
t3 = space(); t3 = space();
button2 = element("button"); button2 = element("button");
button2.textContent = "or me!"; button2.textContent = "or me!";
dispose = [
listen(button0, "click", stop_propagation(prevent_default(handleClick))),
listen(button1, "click", handleClick, { once: true, capture: true }),
listen(button2, "click", handleClick, true),
listen(div, "touchstart", handleTouchstart, { passive: true })
];
}, },
m(target, anchor) { m(target, anchor) {
insert(target, div, anchor); insert(target, div, anchor);
@ -50,6 +43,13 @@ function create_fragment(ctx) {
append(div, button1); append(div, button1);
append(div, t3); append(div, t3);
append(div, button2); append(div, button2);
dispose = [
listen(button0, "click", stop_propagation(prevent_default(handleClick))),
listen(button1, "click", handleClick, { once: true, capture: true }),
listen(button2, "click", handleClick, true),
listen(div, "touchstart", handleTouchstart, { passive: true })
];
}, },
p: noop, p: noop,
i: noop, i: noop,

@ -20,10 +20,10 @@ function create_fragment(ctx) {
input = element("input"); input = element("input");
attr(input, "type", "file"); attr(input, "type", "file");
input.multiple = true; input.multiple = true;
dispose = listen(input, "change", /*input_change_handler*/ ctx[1]);
}, },
m(target, anchor) { m(target, anchor) {
insert(target, input, anchor); insert(target, input, anchor);
dispose = listen(input, "change", /*input_change_handler*/ ctx[1]);
}, },
p: noop, p: noop,
i: noop, i: noop,

@ -31,11 +31,6 @@ function create_fragment(ctx) {
button.textContent = "Store"; button.textContent = "Store";
attr(input, "type", "text"); attr(input, "type", "text");
input.required = true; input.required = true;
dispose = [
listen(input, "input", /*input_input_handler*/ ctx[2]),
listen(form, "submit", /*handleSubmit*/ ctx[1])
];
}, },
m(target, anchor) { m(target, anchor) {
insert(target, form, anchor); insert(target, form, anchor);
@ -43,6 +38,11 @@ function create_fragment(ctx) {
set_input_value(input, /*test*/ ctx[0]); set_input_value(input, /*test*/ ctx[0]);
append(form, t0); append(form, t0);
append(form, button); append(form, button);
dispose = [
listen(input, "input", /*input_input_handler*/ ctx[2]),
listen(form, "submit", /*handleSubmit*/ ctx[1])
];
}, },
p(ctx, [dirty]) { p(ctx, [dirty]) {
if (dirty & /*test*/ 1 && input.value !== /*test*/ ctx[0]) { if (dirty & /*test*/ 1 && input.value !== /*test*/ ctx[0]) {

@ -22,16 +22,16 @@ function create_fragment(ctx) {
c() { c() {
input = element("input"); input = element("input");
attr(input, "type", "range"); attr(input, "type", "range");
},
m(target, anchor) {
insert(target, input, anchor);
set_input_value(input, /*value*/ ctx[0]);
dispose = [ dispose = [
listen(input, "change", /*input_change_input_handler*/ ctx[1]), listen(input, "change", /*input_change_input_handler*/ ctx[1]),
listen(input, "input", /*input_change_input_handler*/ ctx[1]) listen(input, "input", /*input_change_input_handler*/ ctx[1])
]; ];
}, },
m(target, anchor) {
insert(target, input, anchor);
set_input_value(input, /*value*/ ctx[0]);
},
p(ctx, [dirty]) { p(ctx, [dirty]) {
if (dirty & /*value*/ 1) { if (dirty & /*value*/ 1) {
set_input_value(input, /*value*/ ctx[0]); set_input_value(input, /*value*/ ctx[0]);

@ -30,7 +30,6 @@ function create_fragment(ctx) {
t1 = text(/*name*/ ctx[0]); t1 = text(/*name*/ ctx[0]);
t2 = text("!"); t2 = text("!");
input.value = /*name*/ ctx[0]; input.value = /*name*/ ctx[0];
dispose = listen(input, "input", /*onInput*/ ctx[1]);
}, },
m(target, anchor) { m(target, anchor) {
insert(target, input, anchor); insert(target, input, anchor);
@ -38,6 +37,7 @@ function create_fragment(ctx) {
insert(target, h1, anchor); insert(target, h1, anchor);
append(h1, t1); append(h1, t1);
append(h1, t2); append(h1, t2);
dispose = listen(input, "input", /*onInput*/ ctx[1]);
}, },
p(ctx, [dirty]) { p(ctx, [dirty]) {
if (dirty & /*name*/ 1 && input.value !== /*name*/ ctx[0]) { if (dirty & /*name*/ 1 && input.value !== /*name*/ ctx[0]) {

@ -19,11 +19,11 @@ function create_fragment(ctx) {
c() { c() {
input = element("input"); input = element("input");
attr(input, "type", "checkbox"); attr(input, "type", "checkbox");
dispose = listen(input, "change", /*input_change_handler*/ ctx[1]);
}, },
m(target, anchor) { m(target, anchor) {
insert(target, input, anchor); insert(target, input, anchor);
input.checked = /*foo*/ ctx[0]; input.checked = /*foo*/ ctx[0];
dispose = listen(input, "change", /*input_change_handler*/ ctx[1]);
}, },
p(ctx, [dirty]) { p(ctx, [dirty]) {
if (dirty & /*foo*/ 1) { if (dirty & /*foo*/ 1) {

@ -30,7 +30,6 @@ function create_fragment(ctx) {
p = element("p"); p = element("p");
t2 = text("x: "); t2 = text("x: ");
t3 = text(/*x*/ ctx[0]); t3 = text(/*x*/ ctx[0]);
dispose = listen(button, "click", /*foo*/ ctx[1]);
}, },
m(target, anchor) { m(target, anchor) {
insert(target, button, anchor); insert(target, button, anchor);
@ -38,6 +37,7 @@ function create_fragment(ctx) {
insert(target, p, anchor); insert(target, p, anchor);
append(p, t2); append(p, t2);
append(p, t3); append(p, t3);
dispose = listen(button, "click", /*foo*/ ctx[1]);
}, },
p(ctx, [dirty]) { p(ctx, [dirty]) {
if (dirty & /*x*/ 1) set_data(t3, /*x*/ ctx[0]); if (dirty & /*x*/ 1) set_data(t3, /*x*/ ctx[0]);

@ -31,7 +31,6 @@ function create_fragment(ctx) {
p = element("p"); p = element("p");
t2 = text("number of things: "); t2 = text("number of things: ");
t3 = text(t3_value); t3 = text(t3_value);
dispose = listen(button, "click", /*foo*/ ctx[1]);
}, },
m(target, anchor) { m(target, anchor) {
insert(target, button, anchor); insert(target, button, anchor);
@ -39,6 +38,7 @@ function create_fragment(ctx) {
insert(target, p, anchor); insert(target, p, anchor);
append(p, t2); append(p, t2);
append(p, t3); append(p, t3);
dispose = listen(button, "click", /*foo*/ ctx[1]);
}, },
p(ctx, [dirty]) { p(ctx, [dirty]) {
if (dirty & /*things*/ 1 && t3_value !== (t3_value = /*things*/ ctx[0].length + "")) set_data(t3, t3_value); if (dirty & /*things*/ 1 && t3_value !== (t3_value = /*things*/ ctx[0].length + "")) set_data(t3, t3_value);

@ -30,7 +30,6 @@ function create_fragment(ctx) {
p = element("p"); p = element("p");
t2 = text("x: "); t2 = text("x: ");
t3 = text(/*x*/ ctx[0]); t3 = text(/*x*/ ctx[0]);
dispose = listen(button, "click", /*click_handler*/ ctx[1]);
}, },
m(target, anchor) { m(target, anchor) {
insert(target, button, anchor); insert(target, button, anchor);
@ -38,6 +37,7 @@ function create_fragment(ctx) {
insert(target, p, anchor); insert(target, p, anchor);
append(p, t2); append(p, t2);
append(p, t3); append(p, t3);
dispose = listen(button, "click", /*click_handler*/ ctx[1]);
}, },
p(ctx, [dirty]) { p(ctx, [dirty]) {
if (dirty & /*x*/ 1) set_data(t3, /*x*/ ctx[0]); if (dirty & /*x*/ 1) set_data(t3, /*x*/ ctx[0]);

@ -31,7 +31,6 @@ function create_fragment(ctx) {
p = element("p"); p = element("p");
t2 = text("number of things: "); t2 = text("number of things: ");
t3 = text(t3_value); t3 = text(t3_value);
dispose = listen(button, "click", /*click_handler*/ ctx[1]);
}, },
m(target, anchor) { m(target, anchor) {
insert(target, button, anchor); insert(target, button, anchor);
@ -39,6 +38,7 @@ function create_fragment(ctx) {
insert(target, p, anchor); insert(target, p, anchor);
append(p, t2); append(p, t2);
append(p, t3); append(p, t3);
dispose = listen(button, "click", /*click_handler*/ ctx[1]);
}, },
p(ctx, [dirty]) { p(ctx, [dirty]) {
if (dirty & /*things*/ 1 && t3_value !== (t3_value = /*things*/ ctx[0].length + "")) set_data(t3, t3_value); if (dirty & /*things*/ 1 && t3_value !== (t3_value = /*things*/ ctx[0].length + "")) set_data(t3, t3_value);

@ -41,6 +41,17 @@ function create_fragment(ctx) {
if (/*duration*/ ctx[4] === void 0) add_render_callback(() => /*audio_durationchange_handler*/ ctx[13].call(audio)); if (/*duration*/ ctx[4] === void 0) add_render_callback(() => /*audio_durationchange_handler*/ ctx[13].call(audio));
if (/*seeking*/ ctx[8] === void 0) add_render_callback(() => /*audio_seeking_seeked_handler*/ ctx[17].call(audio)); if (/*seeking*/ ctx[8] === void 0) add_render_callback(() => /*audio_seeking_seeked_handler*/ ctx[17].call(audio));
if (/*ended*/ ctx[9] === void 0) add_render_callback(() => /*audio_ended_handler*/ ctx[18].call(audio)); if (/*ended*/ ctx[9] === void 0) add_render_callback(() => /*audio_ended_handler*/ ctx[18].call(audio));
},
m(target, anchor) {
insert(target, audio, anchor);
if (!isNaN(/*volume*/ ctx[6])) {
audio.volume = /*volume*/ ctx[6];
}
if (!isNaN(/*playbackRate*/ ctx[7])) {
audio.playbackRate = /*playbackRate*/ ctx[7];
}
dispose = [ dispose = [
listen(audio, "progress", /*audio_progress_handler*/ ctx[10]), listen(audio, "progress", /*audio_progress_handler*/ ctx[10]),
@ -56,17 +67,6 @@ function create_fragment(ctx) {
listen(audio, "ended", /*audio_ended_handler*/ ctx[18]) listen(audio, "ended", /*audio_ended_handler*/ ctx[18])
]; ];
}, },
m(target, anchor) {
insert(target, audio, anchor);
if (!isNaN(/*volume*/ ctx[6])) {
audio.volume = /*volume*/ ctx[6];
}
if (!isNaN(/*playbackRate*/ ctx[7])) {
audio.playbackRate = /*playbackRate*/ ctx[7];
}
},
p(ctx, [dirty]) { p(ctx, [dirty]) {
if (!audio_updating && dirty & /*currentTime*/ 8 && !isNaN(/*currentTime*/ ctx[3])) { if (!audio_updating && dirty & /*currentTime*/ 8 && !isNaN(/*currentTime*/ ctx[3])) {
audio.currentTime = /*currentTime*/ ctx[3]; audio.currentTime = /*currentTime*/ ctx[3];

@ -37,16 +37,16 @@ function create_fragment(ctx) {
video = element("video"); video = element("video");
if (/*videoHeight*/ ctx[1] === void 0 || /*videoWidth*/ ctx[2] === void 0) add_render_callback(() => /*video_resize_handler*/ ctx[5].call(video)); if (/*videoHeight*/ ctx[1] === void 0 || /*videoWidth*/ ctx[2] === void 0) add_render_callback(() => /*video_resize_handler*/ ctx[5].call(video));
add_render_callback(() => /*video_elementresize_handler*/ ctx[6].call(video)); add_render_callback(() => /*video_elementresize_handler*/ ctx[6].call(video));
},
m(target, anchor) {
insert(target, video, anchor);
video_resize_listener = add_resize_listener(video, /*video_elementresize_handler*/ ctx[6].bind(video));
dispose = [ dispose = [
listen(video, "timeupdate", video_timeupdate_handler), listen(video, "timeupdate", video_timeupdate_handler),
listen(video, "resize", /*video_resize_handler*/ ctx[5]) listen(video, "resize", /*video_resize_handler*/ ctx[5])
]; ];
}, },
m(target, anchor) {
insert(target, video, anchor);
video_resize_listener = add_resize_listener(video, /*video_elementresize_handler*/ ctx[6].bind(video));
},
p(ctx, [dirty]) { p(ctx, [dirty]) {
if (!video_updating && dirty & /*currentTime*/ 1 && !isNaN(/*currentTime*/ ctx[0])) { if (!video_updating && dirty & /*currentTime*/ 1 && !isNaN(/*currentTime*/ ctx[0])) {
video.currentTime = /*currentTime*/ ctx[0]; video.currentTime = /*currentTime*/ ctx[0];

@ -14,13 +14,13 @@ function create_fragment(ctx) {
add_render_callback(/*onlinestatuschanged*/ ctx[1]); add_render_callback(/*onlinestatuschanged*/ ctx[1]);
return { return {
c() { c: noop,
m(target, anchor) {
dispose = [ dispose = [
listen(window, "online", /*onlinestatuschanged*/ ctx[1]), listen(window, "online", /*onlinestatuschanged*/ ctx[1]),
listen(window, "offline", /*onlinestatuschanged*/ ctx[1]) listen(window, "offline", /*onlinestatuschanged*/ ctx[1])
]; ];
}, },
m: noop,
p: noop, p: noop,
i: noop, i: noop,
o: noop, o: noop,

@ -33,6 +33,11 @@ function create_fragment(ctx) {
p = element("p"); p = element("p");
t0 = text("scrolled to "); t0 = text("scrolled to ");
t1 = text(/*y*/ ctx[0]); t1 = text(/*y*/ ctx[0]);
},
m(target, anchor) {
insert(target, p, anchor);
append(p, t0);
append(p, t1);
dispose = listen(window, "scroll", () => { dispose = listen(window, "scroll", () => {
scrolling = true; scrolling = true;
@ -41,11 +46,6 @@ function create_fragment(ctx) {
/*onwindowscroll*/ ctx[1](); /*onwindowscroll*/ ctx[1]();
}); });
}, },
m(target, anchor) {
insert(target, p, anchor);
append(p, t0);
append(p, t1);
},
p(ctx, [dirty]) { p(ctx, [dirty]) {
if (dirty & /*y*/ 1 && !scrolling) { if (dirty & /*y*/ 1 && !scrolling) {
scrolling = true; scrolling = true;

@ -0,0 +1,8 @@
const result = {};
export default {
props: { result },
async test({ assert, component, target, window }) {
assert.notEqual(result.parentElement, null);
}
};

@ -0,0 +1,8 @@
<script>
export let result;
function onMountAction(node) {
result.parentElement = node.parentElement;
}
</script>
<h1 use:onMountAction>Hello!</h1>
Loading…
Cancel
Save