From 10011a5142cd4c07786cb9abc3092720b306b5b3 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 28 Oct 2018 14:09:21 -0400 Subject: [PATCH] hoist these --- src/compile/nodes/Element.ts | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/compile/nodes/Element.ts b/src/compile/nodes/Element.ts index cf3a1323f2..9fa630124e 100644 --- a/src/compile/nodes/Element.ts +++ b/src/compile/nodes/Element.ts @@ -57,6 +57,22 @@ const a11yRequiredContent = new Set([ const invisibleElements = new Set(['meta', 'html', 'script', 'style']); +const validModifiers = new Set([ + 'preventDefault', + 'stopPropagation', + 'capture', + 'once', + 'passive' +]); + +const passiveEvents = new Set([ + 'wheel', + 'touchstart', + 'touchmove', + 'touchend', + 'touchcancel' +]); + export default class Element extends Node { type: 'Element'; name: string; @@ -568,22 +584,6 @@ export default class Element extends Node { validateEventHandlers() { const { component } = this; - const validModifiers = new Set([ - 'preventDefault', - 'stopPropagation', - 'capture', - 'once', - 'passive' - ]); - - const passiveEvents = new Set([ - 'wheel', - 'touchstart', - 'touchmove', - 'touchend', - 'touchcancel' - ]); - this.handlers.forEach(handler => { if (handler.modifiers.has('passive') && handler.modifiers.has('preventDefault')) { component.error(handler, {