Skip to content

Commit 4a3237a

Browse files
committed
refactor: use Event constructor
close #5723 Since we no longer support IE11, it is safe to use Event() constructor
1 parent 74d2a76 commit 4a3237a

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

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

+1-7
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,10 @@ function onCompositionEnd(e: Event) {
3030
const target = e.target as any
3131
if (target.composing) {
3232
target.composing = false
33-
trigger(target, 'input')
33+
target.dispatchEvent(new Event('input'))
3434
}
3535
}
3636

37-
function trigger(el: HTMLElement, type: string) {
38-
const e = document.createEvent('HTMLEvents')
39-
e.initEvent(type, true, true)
40-
el.dispatchEvent(e)
41-
}
42-
4337
type ModelDirective<T> = ObjectDirective<T & { _assign: AssignerFn }>
4438

4539
// We are exporting the v-model runtime directly as vnode hooks so that it can

0 commit comments

Comments
 (0)