diff --git a/src/compile/Component.ts b/src/compile/Component.ts index 541814a1ff..c9c985339f 100644 --- a/src/compile/Component.ts +++ b/src/compile/Component.ts @@ -170,6 +170,7 @@ export default class Component { const props = [...this.template_references]; this.declarations.push(...props); addToSet(this.writable_declarations, this.template_references); + addToSet(this.userVars, this.template_references); this.props = props.map(name => ({ name, diff --git a/test/js/samples/deconflict-builtins/expected.js b/test/js/samples/deconflict-builtins/expected.js index 3f73d83574..fe2a247d3d 100644 --- a/test/js/samples/deconflict-builtins/expected.js +++ b/test/js/samples/deconflict-builtins/expected.js @@ -1,5 +1,5 @@ /* generated by Svelte vX.Y.Z */ -import { SvelteComponent as SvelteComponent_1, append, createComment, createElement, createText, destroyEach, detachNode, flush, init, insert, run, safe_not_equal, setData } from "svelte/internal"; +import { SvelteComponent as SvelteComponent_1, append, createComment, createElement as createElement_1, createText, destroyEach, detachNode, flush, init, insert, run, safe_not_equal, setData } from "svelte/internal"; function get_each_context(ctx, list, i) { const child_ctx = Object.create(ctx); @@ -13,7 +13,7 @@ function create_each_block($$, ctx) { return { c() { - span = createElement("span"); + span = createElement_1("span"); text = createText(text_value); }, diff --git a/test/js/samples/select-dynamic-value/expected.js b/test/js/samples/select-dynamic-value/expected.js index 6788f18fd0..cce868ee40 100644 --- a/test/js/samples/select-dynamic-value/expected.js +++ b/test/js/samples/select-dynamic-value/expected.js @@ -2,7 +2,7 @@ import { SvelteComponent as SvelteComponent_1, append, createElement, detachNode, flush, init, insert, run, safe_not_equal } from "svelte/internal"; function create_fragment($$, ctx) { - var select, option0, option1, select_value_value, current; + var select, option0, option1, select_value_value, current_1; return { c() { @@ -32,7 +32,7 @@ function create_fragment($$, ctx) { } } - current = true; + current_1 = true; }, p(changed, ctx) { @@ -49,7 +49,7 @@ function create_fragment($$, ctx) { }, i(target, anchor) { - if (current) return; + if (current_1) return; this.m(target, anchor); }, diff --git a/test/runtime/samples/event-handler-deconflicted/_config.js b/test/runtime/samples/event-handler-deconflicted/_config.js new file mode 100644 index 0000000000..69151997a0 --- /dev/null +++ b/test/runtime/samples/event-handler-deconflicted/_config.js @@ -0,0 +1,11 @@ +export default { + preserveIdentifiers: true, + + props: { + click_handler: 'x' + }, + + html: ` + + ` +}; diff --git a/test/runtime/samples/event-handler-deconflicted/main.html b/test/runtime/samples/event-handler-deconflicted/main.html new file mode 100644 index 0000000000..38c923794e --- /dev/null +++ b/test/runtime/samples/event-handler-deconflicted/main.html @@ -0,0 +1 @@ + \ No newline at end of file