1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-27 22:09:04 +02:00

Dropdown without jQuery

This commit is contained in:
Johann-S
2017-09-26 09:09:40 +02:00
committed by XhmikosR
parent 330a29734f
commit 90261b484c
6 changed files with 226 additions and 183 deletions

View File

@@ -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)
}
}
}