const DATA_KEY = 'bs.popover'
const EVENT_KEY = `.${DATA_KEY}`
const CLASS_PREFIX = 'bs-popover'
-const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g')
const Default = {
...Tooltip.Default,
// Private
- _addAttachmentClass(attachment) {
- this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`)
- }
-
_getContent() {
return this._element.getAttribute('data-bs-content') || this._config.content
}
- _cleanTipClass() {
- const tip = this.getTipElement()
- const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX)
- if (tabClass !== null && tabClass.length > 0) {
- tabClass.map(token => token.trim())
- .forEach(tClass => tip.classList.remove(tClass))
- }
+ _getBasicClassPrefix() {
+ return CLASS_PREFIX
}
// Static
const DATA_KEY = 'bs.tooltip'
const EVENT_KEY = `.${DATA_KEY}`
const CLASS_PREFIX = 'bs-tooltip'
-const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g')
const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn'])
const DefaultType = {
}
_addAttachmentClass(attachment) {
- this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`)
+ this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`)
}
_getAttachment(placement) {
_cleanTipClass() {
const tip = this.getTipElement()
- const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX)
+ 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))
}
}
+ _getBasicClassPrefix() {
+ return CLASS_PREFIX
+ }
+
_handlePopperPlacementChange(popperData) {
const { state } = popperData