aboutsummaryrefslogtreecommitdiff
path: root/js/src/tooltip.js
diff options
context:
space:
mode:
authorPriyansh <[email protected]>2021-10-06 14:40:59 -0400
committerGitHub <[email protected]>2021-10-06 14:40:59 -0400
commit52cd86f8710f8049a744b5bcb9f4a7ce19114b6e (patch)
tree8956dbd6f94ae25d273d496e64840ed30b6d88a5 /js/src/tooltip.js
parentd065706ce4b439b5c77d9a68e708212e91cc4f0b (diff)
parentc331a150cdc2834f08bcf458cdb1b104cc510b67 (diff)
downloadbootstrap-52cd86f8710f8049a744b5bcb9f4a7ce19114b6e.tar.xz
bootstrap-52cd86f8710f8049a744b5bcb9f4a7ce19114b6e.zip
Merge branch 'twbs:main' into main
Diffstat (limited to 'js/src/tooltip.js')
-rw-r--r--js/src/tooltip.js24
1 files changed, 13 insertions, 11 deletions
diff --git a/js/src/tooltip.js b/js/src/tooltip.js
index 747555411..afd17da53 100644
--- a/js/src/tooltip.js
+++ b/js/src/tooltip.js
@@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.1.1): tooltip.js
+ * Bootstrap (v5.1.2): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -285,9 +285,9 @@ class Tooltip extends BaseComponent {
// only needed because of broken event delegation on iOS
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
if ('ontouchstart' in document.documentElement) {
- [].concat(...document.body.children).forEach(element => {
+ for (const element of [].concat(...document.body.children)) {
EventHandler.on(element, 'mouseover', noop)
- })
+ }
}
const complete = () => {
@@ -337,8 +337,9 @@ class Tooltip extends BaseComponent {
// If this is a touch-enabled device we remove the extra
// empty mouseover listeners we added for iOS support
if ('ontouchstart' in document.documentElement) {
- [].concat(...document.body.children)
- .forEach(element => EventHandler.off(element, 'mouseover', noop))
+ for (const element of [].concat(...document.body.children)) {
+ EventHandler.off(element, 'mouseover', noop)
+ }
}
this._activeTrigger[TRIGGER_CLICK] = false
@@ -527,7 +528,7 @@ class Tooltip extends BaseComponent {
_setListeners() {
const triggers = this._config.trigger.split(' ')
- triggers.forEach(trigger => {
+ for (const trigger of triggers) {
if (trigger === 'click') {
EventHandler.on(this._element, this.constructor.Event.CLICK, this._config.selector, event => this.toggle(event))
} else if (trigger !== TRIGGER_MANUAL) {
@@ -541,7 +542,7 @@ class Tooltip extends BaseComponent {
EventHandler.on(this._element, eventIn, this._config.selector, event => this._enter(event))
EventHandler.on(this._element, eventOut, this._config.selector, event => this._leave(event))
}
- })
+ }
this._hideModalHandler = () => {
if (this._element) {
@@ -648,11 +649,11 @@ class Tooltip extends BaseComponent {
_getConfig(config) {
const dataAttributes = Manipulator.getDataAttributes(this._element)
- Object.keys(dataAttributes).forEach(dataAttr => {
+ for (const dataAttr of Object.keys(dataAttributes)) {
if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
delete dataAttributes[dataAttr]
}
- })
+ }
config = {
...this.constructor.Default,
@@ -706,8 +707,9 @@ class Tooltip extends BaseComponent {
const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g')
const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex)
if (tabClass !== null && tabClass.length > 0) {
- tabClass.map(token => token.trim())
- .forEach(tClass => tip.classList.remove(tClass))
+ for (const tClass of tabClass.map(token => token.trim())) {
+ tip.classList.remove(tClass)
+ }
}
}