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
diff options
context:
space:
mode:
authorJohann-S <johann.servoire@gmail.com>2017-04-07 14:20:34 +0300
committerJohann-S <johann.servoire@gmail.com>2017-05-14 12:41:19 +0300
commitb40b1bc396adb80944b887f72d0ae616277c852d (patch)
tree87d170caace642d8f2b195ddad863d1d36902377 /js/src/popover.js
parent81e07ec05218d75d64454787449dcb870b5b66ec (diff)
Add attachment classes
Diffstat (limited to 'js/src/popover.js')
-rw-r--r--js/src/popover.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/js/src/popover.js b/js/src/popover.js
index 02efe2b2ed..f89d3d5c8b 100644
--- a/js/src/popover.js
+++ b/js/src/popover.js
@@ -22,6 +22,8 @@ const Popover = (($) => {
const DATA_KEY = 'bs.popover'
const EVENT_KEY = `.${DATA_KEY}`
const JQUERY_NO_CONFLICT = $.fn[NAME]
+ const CLASS_PREFIX = 'bs-popover'
+ const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g')
const Default = $.extend({}, Tooltip.Default, {
placement : 'right',
@@ -107,6 +109,10 @@ const Popover = (($) => {
return this.getTitle() || this._getContent()
}
+ addAttachmentClass(attachment) {
+ $(this.getTipElement()).addClass(`${CLASS_PREFIX}-${attachment}`)
+ }
+
getTipElement() {
return this.tip = this.tip || $(this.config.template)[0]
}
@@ -130,6 +136,14 @@ const Popover = (($) => {
this.config.content)
}
+ _cleanTipClass() {
+ const $tip = $(this.getTipElement())
+ const tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX)
+ if (tabClass !== null && tabClass.length > 0) {
+ $tip.removeClass(tabClass.join(''))
+ }
+ }
+
// static