1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-07 06:06:47 +02:00

Event handler: replace deprecated initEvent

This commit is contained in:
GeoSot
2021-12-16 13:23:17 +02:00
committed by XhmikosR
parent 640542e606
commit fa93995123
4 changed files with 6 additions and 15 deletions

View File

@@ -289,7 +289,6 @@ const EventHandler = {
let bubbles = true
let nativeDispatch = true
let defaultPrevented = false
let evt = null
if (inNamespace && $) {
jQueryEvent = $.Event(event, args)
@@ -300,12 +299,9 @@ const EventHandler = {
defaultPrevented = jQueryEvent.isDefaultPrevented()
}
if (isNative) {
evt = document.createEvent('HTMLEvents')
evt.initEvent(typeEvent, bubbles, true)
} else {
evt = new CustomEvent(event, { bubbles, cancelable: true })
}
const evt = isNative ?
new Event(event, { bubbles, cancelable: true }) :
new CustomEvent(event, { bubbles, cancelable: true })
// merge custom information in our event
if (typeof args !== 'undefined') {