mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-02 18:02:37 +02:00
Dropdown without jQuery
This commit is contained in:
@@ -334,7 +334,7 @@ const EventHandler = (() => {
|
||||
let defaultPrevented = false
|
||||
|
||||
if (inNamespace && typeof $ !== 'undefined') {
|
||||
jQueryEvent = new $.Event(event, args)
|
||||
jQueryEvent = $.Event(event, args)
|
||||
|
||||
$(element).trigger(jQueryEvent)
|
||||
bubbles = !jQueryEvent.isPropagationStopped()
|
||||
@@ -342,8 +342,7 @@ const EventHandler = (() => {
|
||||
defaultPrevented = jQueryEvent.isDefaultPrevented()
|
||||
}
|
||||
|
||||
let evt = null
|
||||
|
||||
let evt = null
|
||||
if (isNative) {
|
||||
evt = document.createEvent('HTMLEvents')
|
||||
evt.initEvent(typeEvent, bubbles, true)
|
||||
|
@@ -38,6 +38,18 @@ const Manipulator = {
|
||||
}
|
||||
|
||||
element.removeAttribute(`data-${key.replace(/[A-Z]/g, (chr) => `-${chr.toLowerCase()}`)}`)
|
||||
},
|
||||
|
||||
toggleClass(element, className) {
|
||||
if (typeof element === 'undefined' || element === null) {
|
||||
return
|
||||
}
|
||||
|
||||
if (element.classList.contains(className)) {
|
||||
element.classList.remove(className)
|
||||
} else {
|
||||
element.classList.add(className)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user