refactor: use Event constructor

close #5723

Since we no longer support IE11, it is safe to use Event() constructor
This commit is contained in:
Evan You 2022-04-16 11:26:00 +08:00
parent 74d2a76af6
commit 4a3237ad93

View File

@ -30,16 +30,10 @@ function onCompositionEnd(e: Event) {
const target = e.target as any const target = e.target as any
if (target.composing) { if (target.composing) {
target.composing = false 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 }> type ModelDirective<T> = ObjectDirective<T & { _assign: AssignerFn }>
// We are exporting the v-model runtime directly as vnode hooks so that it can // We are exporting the v-model runtime directly as vnode hooks so that it can