From 0b9928476f17c788a889c950ad6e733e5c933454 Mon Sep 17 00:00:00 2001 From: Maxim Matyunin Date: Sun, 4 Aug 2019 22:06:41 +0900 Subject: [PATCH] any -> $$any --- src/compiler/compile/nodes/EventHandler.ts | 14 ++++++++------ .../wrappers/shared/add_event_handlers.ts | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/compiler/compile/nodes/EventHandler.ts b/src/compiler/compile/nodes/EventHandler.ts index 0f9ff0dfd9..6cf867daa5 100644 --- a/src/compiler/compile/nodes/EventHandler.ts +++ b/src/compiler/compile/nodes/EventHandler.ts @@ -17,7 +17,7 @@ export default class EventHandler extends Node { constructor(component: Component, parent, template_scope, info) { super(component, parent, template_scope, info); - this.name = info.name !== '*' ? info.name : 'any'; + this.name = info.name !== '*' ? info.name : '$$any'; this.modifiers = new Set(info.modifiers); if (info.expression) { @@ -50,11 +50,13 @@ export default class EventHandler extends Node { referenced: true }); - component.partly_hoisted.push(deindent` - function ${name}(event) { - @bubble($$self, event); - } - `); + if (this.name !== '$$any') { + component.partly_hoisted.push(deindent` + function ${name}(event) { + @bubble($$self, event); + } + `); + } this.handler_name = name; } diff --git a/src/compiler/compile/render_dom/wrappers/shared/add_event_handlers.ts b/src/compiler/compile/render_dom/wrappers/shared/add_event_handlers.ts index 9cc24836af..cf46366ca2 100644 --- a/src/compiler/compile/render_dom/wrappers/shared/add_event_handlers.ts +++ b/src/compiler/compile/render_dom/wrappers/shared/add_event_handlers.ts @@ -21,7 +21,7 @@ export default function add_event_handlers( block.event_listeners.push( `@listen(${target}, "${handler.name}", ${snippet}, ${opts_string})` ); - } else if (handler.name === 'any') { + } else if (handler.name === '$$any') { block.any_event_elements.push(target); // This isn't required but listen is treeshaken otherwise block.event_listeners.push(