Merge pull request #2232 from sveltejs/gh-2222

store prop names as $$.props, prevent leaky bindings
pull/2237/head
Rich Harris 7 years ago committed by GitHub
commit 66af332f75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -407,6 +407,8 @@ export default function dom(
`); `);
} }
const prop_names = `[${props.map(v => JSON.stringify(v.export_name)).join(', ')}]`;
if (options.customElement) { if (options.customElement) {
builder.addBlock(deindent` builder.addBlock(deindent`
class ${name} extends @SvelteElement { class ${name} extends @SvelteElement {
@ -415,7 +417,7 @@ export default function dom(
${css.code && `this.shadowRoot.innerHTML = \`<style>${escape(css.code, { onlyEscapeAtSymbol: true }).replace(/\\/g, '\\\\')}${options.dev ? `\n/*# sourceMappingURL=${css.map.toUrl()} */` : ''}</style>\`;`} ${css.code && `this.shadowRoot.innerHTML = \`<style>${escape(css.code, { onlyEscapeAtSymbol: true }).replace(/\\/g, '\\\\')}${options.dev ? `\n/*# sourceMappingURL=${css.map.toUrl()} */` : ''}</style>\`;`}
@init(this, { target: this.shadowRoot }, ${definition}, create_fragment, ${not_equal}); @init(this, { target: this.shadowRoot }, ${definition}, create_fragment, ${not_equal}, ${prop_names});
${dev_props_check} ${dev_props_check}
@ -449,7 +451,7 @@ export default function dom(
constructor(options) { constructor(options) {
super(${options.dev && `options`}); super(${options.dev && `options`});
${should_add_css && `if (!document.getElementById("${component.stylesheet.id}-style")) @add_css();`} ${should_add_css && `if (!document.getElementById("${component.stylesheet.id}-style")) @add_css();`}
@init(this, options, ${definition}, create_fragment, ${not_equal}); @init(this, options, ${definition}, create_fragment, ${not_equal}, ${prop_names});
${dev_props_check} ${dev_props_check}
} }

@ -5,6 +5,7 @@ import { blankObject } from './utils.js';
import { children } from './dom.js'; import { children } from './dom.js';
export function bind(component, name, callback) { export function bind(component, name, callback) {
if (component.$$.props.indexOf(name) === -1) return;
component.$$.bound[name] = callback; component.$$.bound[name] = callback;
callback(component.$$.ctx[name]); callback(component.$$.ctx[name]);
} }
@ -53,7 +54,7 @@ function make_dirty(component, key) {
component.$$.dirty[key] = true; component.$$.dirty[key] = true;
} }
export function init(component, options, instance, create_fragment, not_equal) { export function init(component, options, instance, create_fragment, not_equal, prop_names) {
const parent_component = current_component; const parent_component = current_component;
set_current_component(component); set_current_component(component);
@ -64,6 +65,7 @@ export function init(component, options, instance, create_fragment, not_equal) {
ctx: null, ctx: null,
// state // state
props: prop_names,
update: noop, update: noop,
not_equal, not_equal,
bound: blankObject(), bound: blankObject(),

@ -54,7 +54,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["bar"]);
} }
get bar() { get bar() {

@ -48,7 +48,7 @@ function link(node) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, null, create_fragment, safe_not_equal); init(this, options, null, create_fragment, safe_not_equal, []);
} }
} }

@ -51,7 +51,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["w", "h"]);
} }
get w() { get w() {

@ -54,7 +54,7 @@ class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
if (!document.getElementById("svelte-1a7i8ec-style")) add_css(); if (!document.getElementById("svelte-1a7i8ec-style")) add_css();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["foo"]);
} }
get foo() { get foo() {

@ -45,7 +45,7 @@ function instance($$self) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, []);
} }
} }

@ -45,7 +45,7 @@ function instance($$self) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, not_equal); init(this, options, instance, create_fragment, not_equal, []);
} }
} }

@ -45,7 +45,7 @@ function instance($$self) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, not_equal); init(this, options, instance, create_fragment, not_equal, []);
} }
} }

@ -45,7 +45,7 @@ function instance($$self) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, []);
} }
} }

@ -33,7 +33,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["x", "a", "b"]);
} }
get x() { get x() {

@ -37,7 +37,7 @@ class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
if (!document.getElementById("svelte-1slhpfn-style")) add_css(); if (!document.getElementById("svelte-1slhpfn-style")) add_css();
init(this, options, null, create_fragment, safe_not_equal); init(this, options, null, create_fragment, safe_not_equal, []);
} }
} }

@ -33,7 +33,7 @@ class SvelteComponent extends SvelteElement {
this.shadowRoot.innerHTML = `<style>div{animation:foo 1s}@keyframes foo{0%{opacity:0}100%{opacity:1}}</style>`; this.shadowRoot.innerHTML = `<style>div{animation:foo 1s}@keyframes foo{0%{opacity:0}100%{opacity:1}}</style>`;
init(this, { target: this.shadowRoot }, null, create_fragment, safe_not_equal); init(this, { target: this.shadowRoot }, null, create_fragment, safe_not_equal, []);
if (options) { if (options) {
if (options.target) { if (options.target) {

@ -62,7 +62,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponentDev { class SvelteComponent extends SvelteComponentDev {
constructor(options) { constructor(options) {
super(options); super(options);
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["name"]);
const { ctx } = this.$$; const { ctx } = this.$$;
const props = options.props || {}; const props = options.props || {};

@ -150,7 +150,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponentDev { class SvelteComponent extends SvelteComponentDev {
constructor(options) { constructor(options) {
super(options); super(options);
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["things", "foo", "bar", "baz"]);
const { ctx } = this.$$; const { ctx } = this.$$;
const props = options.props || {}; const props = options.props || {};

@ -148,7 +148,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponentDev { class SvelteComponent extends SvelteComponentDev {
constructor(options) { constructor(options) {
super(options); super(options);
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["things", "foo"]);
const { ctx } = this.$$; const { ctx } = this.$$;
const props = options.props || {}; const props = options.props || {};

@ -113,7 +113,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["createElement"]);
} }
get createElement() { get createElement() {

@ -30,7 +30,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["foo"]);
} }
get foo() { get foo() {

@ -68,7 +68,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponentDev { class SvelteComponent extends SvelteComponentDev {
constructor(options) { constructor(options) {
super(options); super(options);
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["foo"]);
const { ctx } = this.$$; const { ctx } = this.$$;
const props = options.props || {}; const props = options.props || {};

@ -51,7 +51,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["bar"]);
} }
get bar() { get bar() {

@ -35,7 +35,7 @@ function make_uppercase() {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, null, create_fragment, safe_not_equal); init(this, options, null, create_fragment, safe_not_equal, []);
} }
} }

@ -51,7 +51,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["bar"]);
} }
get bar() { get bar() {

@ -49,7 +49,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["bar"]);
} }
get bar() { get bar() {

@ -44,7 +44,7 @@ function func() {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, null, create_fragment, safe_not_equal); init(this, options, null, create_fragment, safe_not_equal, []);
} }
} }

@ -116,7 +116,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["a", "b", "c", "d", "e"]);
} }
get a() { get a() {

@ -156,7 +156,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["comments", "elapsed", "time", "foo"]);
} }
get comments() { get comments() {

@ -128,7 +128,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["things"]);
} }
get things() { get things() {

@ -98,7 +98,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["things"]);
} }
get things() { get things() {

@ -37,7 +37,7 @@ function touchstart_handler(e) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, null, create_fragment, safe_not_equal); init(this, options, null, create_fragment, safe_not_equal, []);
} }
} }

@ -57,7 +57,7 @@ function handleClick() {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, null, create_fragment, safe_not_equal); init(this, options, null, create_fragment, safe_not_equal, []);
} }
} }

@ -33,7 +33,7 @@ function create_fragment(ctx) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, null, create_fragment, safe_not_equal); init(this, options, null, create_fragment, safe_not_equal, []);
} }
} }

@ -34,7 +34,7 @@ function get_answer() { return ANSWER; }
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, null, create_fragment, safe_not_equal); init(this, options, null, create_fragment, safe_not_equal, []);
} }
} }

@ -34,7 +34,7 @@ function get_answer() { return ANSWER; }
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, null, create_fragment, safe_not_equal); init(this, options, null, create_fragment, safe_not_equal, []);
} }
} }

@ -104,7 +104,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["foo"]);
} }
get foo() { get foo() {

@ -78,7 +78,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["foo"]);
} }
get foo() { get foo() {

@ -51,7 +51,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["color", "x", "y"]);
} }
get color() { get color() {

@ -44,7 +44,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["data"]);
} }
get data() { get data() {

@ -44,7 +44,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["color"]);
} }
get color() { get color() {

@ -57,7 +57,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["style", "key", "value"]);
} }
get style() { get style() {

@ -48,7 +48,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["files"]);
} }
get files() { get files() {

@ -56,7 +56,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["value"]);
} }
get value() { get value() {

@ -52,7 +52,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["foo"]);
} }
get foo() { get foo() {

@ -57,7 +57,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, []);
} }
} }

@ -58,7 +58,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, []);
} }
} }

@ -57,7 +57,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, []);
} }
} }

@ -55,7 +55,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, []);
} }
} }

@ -29,7 +29,7 @@ function create_fragment(ctx) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, null, create_fragment, safe_not_equal); init(this, options, null, create_fragment, safe_not_equal, []);
} }
} }

@ -123,7 +123,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["buffered", "seekable", "played", "currentTime", "duration", "paused", "volume"]);
} }
get buffered() { get buffered() {

@ -55,7 +55,7 @@ function create_fragment(ctx) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, null, create_fragment, safe_not_equal); init(this, options, null, create_fragment, safe_not_equal, []);
} }
} }

@ -36,7 +36,7 @@ let name = 'world';
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, null, create_fragment, safe_not_equal); init(this, options, null, create_fragment, safe_not_equal, []);
} }
} }

@ -37,7 +37,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["x"]);
} }
get x() { get x() {

@ -33,7 +33,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, []);
} }
} }

@ -70,7 +70,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["current"]);
} }
get current() { get current() {

@ -21,7 +21,7 @@ function foo(bar) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, null, create_fragment, safe_not_equal); init(this, options, null, create_fragment, safe_not_equal, ["foo"]);
} }
get foo() { get foo() {

@ -32,7 +32,7 @@ function create_fragment(ctx) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, null, create_fragment, safe_not_equal); init(this, options, null, create_fragment, safe_not_equal, []);
} }
} }

@ -35,7 +35,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["custom"]);
} }
get custom() { get custom() {

@ -139,7 +139,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["x", "y"]);
} }
get x() { get x() {

@ -263,7 +263,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["a", "b", "c", "d", "e"]);
} }
get a() { get a() {

@ -68,7 +68,7 @@ function instance($$self, $$props, $$invalidate) {
class SvelteComponent extends SvelteComponent_1 { class SvelteComponent extends SvelteComponent_1 {
constructor(options) { constructor(options) {
super(); super();
init(this, options, instance, create_fragment, safe_not_equal); init(this, options, instance, create_fragment, safe_not_equal, ["y"]);
} }
get y() { get y() {

@ -0,0 +1,5 @@
<script>
let count = 0;
</script>
<button on:click='{() => count += 1}'>{count}</button>

@ -0,0 +1,27 @@
export default {
html: `
<button>0</button>
<p>count: undefined</p>
`,
async test({ assert, component, target, window }) {
const click = new window.MouseEvent('click');
const button = target.querySelector('button');
await button.dispatchEvent(click);
assert.equal(component.x, undefined);
assert.htmlEqual(target.innerHTML, `
<button>1</button>
<p>count: undefined</p>
`);
await button.dispatchEvent(click);
assert.equal(component.x, undefined);
assert.htmlEqual(target.innerHTML, `
<button>2</button>
<p>count: undefined</p>
`);
}
};

@ -0,0 +1,8 @@
<script>
import Counter from './Counter.svelte';
let x;
</script>
<Counter bind:count={x}/>
<p>count: {x}</p>
Loading…
Cancel
Save