From f1d704493bf91cf999ae248cfbd39ea6024b0192 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 28 Oct 2018 14:12:29 -0400 Subject: [PATCH] remove unused code --- .../wrappers/shared/EventHandler.ts | 62 ------------------- 1 file changed, 62 deletions(-) delete mode 100644 src/compile/render-dom/wrappers/shared/EventHandler.ts diff --git a/src/compile/render-dom/wrappers/shared/EventHandler.ts b/src/compile/render-dom/wrappers/shared/EventHandler.ts deleted file mode 100644 index 08d3a0e14a..0000000000 --- a/src/compile/render-dom/wrappers/shared/EventHandler.ts +++ /dev/null @@ -1,62 +0,0 @@ -import Renderer from '../../Renderer'; -import Block from '../../Block'; -import Wrapper from './Wrapper'; -import EventHandler from '../../../nodes/EventHandler'; -import validCalleeObjects from '../../../../utils/validCalleeObjects'; - -export default class EventHandlerWrapper extends Wrapper { - node: EventHandler; - - constructor( - renderer: Renderer, - block: Block, - parent: Wrapper, - node: EventHandler, - stripWhitespace: boolean, - nextSibling: Wrapper - ) { - super(renderer, block, parent, node); - } - - render(block: Block, parentNode: string, parentNodes: string) { - const { renderer } = this; - const { component } = renderer; - - const hoisted = this.node.shouldHoist; - - if (this.node.insertionPoint === null) return; // TODO handle shorthand events here? - - if (!validCalleeObjects.has(this.node.callee.name)) { - const component_name = hoisted ? `component` : block.alias(`component`); - - // allow event.stopPropagation(), this.select() etc - // TODO verify that it's a valid callee (i.e. built-in or declared method) - if (this.node.callee.name[0] === '$' && !component.methods.has(this.node.callee.name)) { - component.code.overwrite( - this.node.insertionPoint, - this.node.insertionPoint + 1, - `${component_name}.store.` - ); - } else { - component.code.prependRight( - this.node.insertionPoint, - `${component_name}.` - ); - } - } - - if (this.node.isCustomEvent) { - this.node.args.forEach(arg => { - arg.overwriteThis(this.parent.var); - }); - - if (this.node.callee && this.node.callee.name === 'this') { - const node = this.node.callee.nodes[0]; - component.code.overwrite(node.start, node.end, this.parent.var, { - storeName: true, - contentOnly: true - }); - } - } - } -} \ No newline at end of file