]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
refactor: use Event constructor
authorEvan You <yyx990803@gmail.com>
Sat, 16 Apr 2022 03:26:00 +0000 (11:26 +0800)
committerEvan You <yyx990803@gmail.com>
Sat, 16 Apr 2022 03:26:00 +0000 (11:26 +0800)
close #5723

Since we no longer support IE11, it is safe to use Event() constructor

packages/runtime-dom/src/directives/vModel.ts

index 8780b5d4977cf4e3060bb9df7a28d651c353a9b0..6ca363a937cf08c880c9b70c42c97c8c2340c5cd 100644 (file)
@@ -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<T> = ObjectDirective<T & { _assign: AssignerFn }>
 
 // We are exporting the v-model runtime directly as vnode hooks so that it can