Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js/src
diff options
context:
space:
mode:
authorJames Remeika <james@remeika.us>2020-11-20 12:56:16 +0300
committerGitHub <noreply@github.com>2020-11-20 12:56:16 +0300
commit2d8c02eb1024ef2ce8877d6484a9ea8a4d9cd67f (patch)
tree1f4a1277f06bd474a76865f301cc1b8c223264fd /js/src
parentffa88deb85b406fc32b3abd4b66169405634bfbe (diff)
tooltip/popover: add a `customClass` option (#31834)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Diffstat (limited to 'js/src')
-rw-r--r--js/src/tooltip.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/js/src/tooltip.js b/js/src/tooltip.js
index 4b58f31565..a770340385 100644
--- a/js/src/tooltip.js
+++ b/js/src/tooltip.js
@@ -41,6 +41,7 @@ const DefaultType = {
container: '(string|element|boolean)',
fallbackPlacement: '(string|array)',
boundary: '(string|element)',
+ customClass: '(string|function)',
sanitize: 'boolean',
sanitizeFn: '(null|function)',
whiteList: 'object',
@@ -70,6 +71,7 @@ const Default = {
container: false,
fallbackPlacement: 'flip',
boundary: 'scrollParent',
+ customClass: '',
sanitize: true,
sanitizeFn: null,
whiteList: DefaultWhitelist,
@@ -284,6 +286,7 @@ class Tooltip {
this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment))
$(tip).addClass(CLASS_NAME_SHOW)
+ $(tip).addClass(this._getCustomClass())
// If this is a touch-enabled device we add extra
// empty mouseover listeners to the body's immediate children;
@@ -731,6 +734,10 @@ class Tooltip {
this.config.animation = initConfigAnimation
}
+ _getCustomClass() {
+ return this.element.getAttribute('data-custom-class') || this.config.customClass
+ }
+
// Static
static _jQueryInterface(config) {