mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-27 22:09:04 +02:00
Add attachment classes
This commit is contained in:
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user