Fix "this._recompute is not a function"

Close sveltejs/svelte#2049
pull/2051/head
Thomas Ghysels 6 years ago
parent f7fa81f924
commit ae4adf0040

2
package-lock.json generated

@ -1,6 +1,6 @@
{
"name": "svelte",
"version": "2.15.1",
"version": "2.16.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

@ -289,8 +289,6 @@ export default function dom(
target.insertBefore(this, anchor);
}
});
customElements.define("${component.tag}", ${name});
`);
} else {
builder.addBlock(deindent`
@ -328,6 +326,10 @@ export default function dom(
${immutable && `${name}.prototype._differs = @_differsImmutable;`}
`);
if (component.customElement) {
builder.addBlock(`customElements.define("${component.tag}", ${name});`);
}
let result = builder.toString();
return component.generate(result, options, {

@ -67,10 +67,10 @@ assign(Main.prototype, {
}
});
customElements.define("my-element", Main);
Main.prototype._recompute = noop;
customElements.define("my-element", Main);
function createElement(name) {
return document.createElement(name);
}

@ -59,5 +59,7 @@ assign(SvelteComponent.prototype, {
}
});
customElements.define("custom-element", SvelteComponent);
export default SvelteComponent;
Loading…
Cancel
Save