Merge pull request #1966 from sveltejs/gh-1945

fix dynamic component event code generation
pull/1983/head
Rich Harris 6 years ago committed by GitHub
commit 678ce3496f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -304,9 +304,7 @@ export default class InlineComponentWrapper extends Wrapper {
});
const munged_handlers = this.node.handlers.map(handler => {
// TODO return declarations from handler.render()?
const snippet = handler.render(block);
return `${name}.$on("${handler.name}", ${snippet});`;
});
@ -381,10 +379,6 @@ export default class InlineComponentWrapper extends Wrapper {
${name}.$$.fragment.c();
@mount_component(${name}, ${updateMountNode}, ${anchor});
${name}.$$.fragment.i();
${this.node.handlers.map(handler => deindent`
${name}.$on("${handler.name}", ${handler.var});
`)}
} else {
${name} = null;
}

Loading…
Cancel
Save