From 798ae6604b55365e71b19a2bf4a44d74be70bf16 Mon Sep 17 00:00:00 2001 From: Erik Lieben Date: Sat, 22 Oct 2016 11:39:40 +0200 Subject: [PATCH] fix(autocomplete): use https://developer.mozilla.org/en-US/docs/Web/Events events and don't add delegate to non-bubling events, resolves #12 --- .../parser/aureliaTags.ts | 98 ++++++++++++++----- 1 file changed, 74 insertions(+), 24 deletions(-) diff --git a/src/server/aurelia-languageservice/parser/aureliaTags.ts b/src/server/aurelia-languageservice/parser/aureliaTags.ts index 4304b476..0b0cde77 100644 --- a/src/server/aurelia-languageservice/parser/aureliaTags.ts +++ b/src/server/aurelia-languageservice/parser/aureliaTags.ts @@ -63,32 +63,82 @@ export const AURELIA_GLOBAL_ATTRIBUTES: Array = [ ]; const actionRedirectOptions = ['delegate', 'trigger', 'call']; +const actionRedirectOptionsNonBubbling = ['trigger', 'call']; const globalEvents = [ - new HTMLAttributeSpecification('abort', defaultBindings), - new HTMLAttributeSpecification('blur', defaultBindings), - new HTMLAttributeSpecification('change', defaultBindings), - new HTMLAttributeSpecification('click', defaultBindings), - new HTMLAttributeSpecification('close', defaultBindings), - new HTMLAttributeSpecification('contextmenu', defaultBindings), - new HTMLAttributeSpecification('dblclick', defaultBindings), - new HTMLAttributeSpecification('error', defaultBindings), - new HTMLAttributeSpecification('focus', defaultBindings), - new HTMLAttributeSpecification('input', defaultBindings), - new HTMLAttributeSpecification('keydown', defaultBindings), - new HTMLAttributeSpecification('keypress', defaultBindings), - new HTMLAttributeSpecification('keyup', defaultBindings), - new HTMLAttributeSpecification('load', defaultBindings), - new HTMLAttributeSpecification('mousedown', defaultBindings), - new HTMLAttributeSpecification('mousemove', defaultBindings), - new HTMLAttributeSpecification('mouseout', defaultBindings), - new HTMLAttributeSpecification('mouseover', defaultBindings), - new HTMLAttributeSpecification('mouseup', defaultBindings), - new HTMLAttributeSpecification('reset', defaultBindings), - new HTMLAttributeSpecification('resize', defaultBindings), - new HTMLAttributeSpecification('scroll', defaultBindings), - new HTMLAttributeSpecification('select', defaultBindings), - new HTMLAttributeSpecification('submit', defaultBindings), + + // Resource Events + new HTMLAttributeSpecification('error', actionRedirectOptionsNonBubbling), + new HTMLAttributeSpecification('abort', actionRedirectOptionsNonBubbling), + new HTMLAttributeSpecification('load', actionRedirectOptionsNonBubbling), + new HTMLAttributeSpecification('unload', actionRedirectOptionsNonBubbling), + + // Focus Events + new HTMLAttributeSpecification('blur', actionRedirectOptionsNonBubbling), + new HTMLAttributeSpecification('focus', actionRedirectOptionsNonBubbling), + + // CSS Animation Events + new HTMLAttributeSpecification('animationstart', actionRedirectOptions), + new HTMLAttributeSpecification('animationend', actionRedirectOptions), + new HTMLAttributeSpecification('animationiteration', actionRedirectOptions), + + // Form Events + new HTMLAttributeSpecification('reset', actionRedirectOptions), + new HTMLAttributeSpecification('submit', actionRedirectOptions), + new HTMLAttributeSpecification('change', actionRedirectOptions), + new HTMLAttributeSpecification('input', actionRedirectOptions), + + // Text Composition Events + new HTMLAttributeSpecification('compositionstart', actionRedirectOptions), + new HTMLAttributeSpecification('compositionupdate', actionRedirectOptions), + new HTMLAttributeSpecification('compositionend', actionRedirectOptions), + + // View Events + new HTMLAttributeSpecification('scroll', actionRedirectOptionsNonBubbling), + + // Clipboard Events + new HTMLAttributeSpecification('cut', actionRedirectOptions), + new HTMLAttributeSpecification('copy', actionRedirectOptions), + new HTMLAttributeSpecification('paste', actionRedirectOptions), + + // Keyboard Events + new HTMLAttributeSpecification('keydown', actionRedirectOptions), + new HTMLAttributeSpecification('keypress', actionRedirectOptions), + new HTMLAttributeSpecification('keyup', actionRedirectOptions), + + // Mouse Events + new HTMLAttributeSpecification('mouseenter', actionRedirectOptionsNonBubbling), + new HTMLAttributeSpecification('mouseover', actionRedirectOptions), + new HTMLAttributeSpecification('mousemove', actionRedirectOptions), + new HTMLAttributeSpecification('mousedown', actionRedirectOptions), + new HTMLAttributeSpecification('mouseup', actionRedirectOptions), + new HTMLAttributeSpecification('mouseout', actionRedirectOptionsNonBubbling), + new HTMLAttributeSpecification('click', actionRedirectOptions), + new HTMLAttributeSpecification('dblclick', actionRedirectOptions), + new HTMLAttributeSpecification('contextmenu', actionRedirectOptions), + new HTMLAttributeSpecification('wheel', actionRedirectOptions), + new HTMLAttributeSpecification('mouseleave', actionRedirectOptionsNonBubbling), + new HTMLAttributeSpecification('mouseout', actionRedirectOptions), + new HTMLAttributeSpecification('select', actionRedirectOptionsNonBubbling), + new HTMLAttributeSpecification('pointerlockchange', actionRedirectOptions), + new HTMLAttributeSpecification('pointerlockerror', actionRedirectOptions), + + // Drag & Drop Events + new HTMLAttributeSpecification('dragstart', actionRedirectOptions), + new HTMLAttributeSpecification('drag', actionRedirectOptions), + new HTMLAttributeSpecification('dragend', actionRedirectOptions), + new HTMLAttributeSpecification('dragenter', actionRedirectOptions), + new HTMLAttributeSpecification('dragover', actionRedirectOptions), + new HTMLAttributeSpecification('dragleave', actionRedirectOptions), + new HTMLAttributeSpecification('drop', actionRedirectOptions), + + // Touch events + new HTMLAttributeSpecification('touchstart', actionRedirectOptions), + new HTMLAttributeSpecification('touchmove', actionRedirectOptions), + new HTMLAttributeSpecification('touchend', actionRedirectOptions), + + // Other + new HTMLAttributeSpecification('close', actionRedirectOptions), ]; export const AURELIA_EVENTS: IEventSet = {