Skip to content

Commit

Permalink
refactor: use Event constructor
Browse files Browse the repository at this point in the history
close vuejs#5723

Since we no longer support IE11, it is safe to use Event() constructor
  • Loading branch information
yyx990803 committed Apr 16, 2022
1 parent 74d2a76 commit 4a3237a
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/runtime-dom/src/directives/vModel.ts
Expand Up @@ -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
Expand Down

0 comments on commit 4a3237a

Please sign in to comment.