From 4a3237ad9300693e465f82a6be3552565a1c4be3 Mon Sep 17 00:00:00 2001 From: Evan You Date: Sat, 16 Apr 2022 11:26:00 +0800 Subject: [PATCH] refactor: use Event constructor close #5723 Since we no longer support IE11, it is safe to use Event() constructor --- packages/runtime-dom/src/directives/vModel.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/runtime-dom/src/directives/vModel.ts b/packages/runtime-dom/src/directives/vModel.ts index 8780b5d4..6ca363a9 100644 --- a/packages/runtime-dom/src/directives/vModel.ts +++ b/packages/runtime-dom/src/directives/vModel.ts @@ -30,16 +30,10 @@ function onCompositionEnd(e: Event) { const target = e.target as any if (target.composing) { target.composing = false - trigger(target, 'input') + target.dispatchEvent(new Event('input')) } } -function trigger(el: HTMLElement, type: string) { - const e = document.createEvent('HTMLEvents') - e.initEvent(type, true, true) - el.dispatchEvent(e) -} - type ModelDirective = ObjectDirective // We are exporting the v-model runtime directly as vnode hooks so that it can