diff --git a/src/compile/nodes/Element.ts b/src/compile/nodes/Element.ts index 11eea89107..43e690bfd7 100644 --- a/src/compile/nodes/Element.ts +++ b/src/compile/nodes/Element.ts @@ -846,7 +846,7 @@ export default class Element extends Node { block.addVariable(name); const fn = `%actions-${action.name}`; - block.builders.hydrate.addLine( + block.builders.mount.addLine( `${name} = ${fn}.call(#component, ${this.var}${snippet ? `, ${snippet}` : ''}) || {};` ); diff --git a/test/js/samples/action/expected-bundle.js b/test/js/samples/action/expected-bundle.js index d47781ac82..9453f3c7aa 100644 --- a/test/js/samples/action/expected-bundle.js +++ b/test/js/samples/action/expected-bundle.js @@ -133,7 +133,7 @@ var proto = { /* generated by Svelte vX.Y.Z */ function link(node) { - + function onClick(event) { event.preventDefault(); history.pushState(null, null, event.target.href); @@ -155,11 +155,11 @@ function create_main_fragment(component, ctx) { a = createElement("a"); a.textContent = "Test"; a.href = "#"; - link_action = link.call(component, a) || {}; }, m(target, anchor) { insert(target, a, anchor); + link_action = link.call(component, a) || {}; }, p: noop, diff --git a/test/js/samples/action/expected.js b/test/js/samples/action/expected.js index cb03f97b8d..fab6e6a2b6 100644 --- a/test/js/samples/action/expected.js +++ b/test/js/samples/action/expected.js @@ -2,7 +2,7 @@ import { assign, createElement, detachNode, init, insert, noop, proto } from "svelte/shared.js"; function link(node) { - + function onClick(event) { event.preventDefault(); history.pushState(null, null, event.target.href); @@ -25,11 +25,11 @@ function create_main_fragment(component, ctx) { a = createElement("a"); a.textContent = "Test"; a.href = "#"; - link_action = link.call(component, a) || {}; }, m(target, anchor) { insert(target, a, anchor); + link_action = link.call(component, a) || {}; }, p: noop,