mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-28 06:20:15 +02:00
Switch to strings constants.
This allows the minifier to mangle the constants. It also allows the linter to find unused strings properly. While at it, remove a few unused properties. File Before After Diff -------------------------------------------------------- bootstrap.bundle.min.js 23.61 kB 22.61 kB -1.00 kB (-4.23 %) bootstrap.min.js 17.04 kB 16.08 kB -0.96 kB (-5.63 %)
This commit is contained in:
@@ -39,16 +39,6 @@ const DefaultType = {
|
||||
content: '(string|element|function)'
|
||||
}
|
||||
|
||||
const ClassName = {
|
||||
FADE: 'fade',
|
||||
SHOW: 'show'
|
||||
}
|
||||
|
||||
const Selector = {
|
||||
TITLE: '.popover-header',
|
||||
CONTENT: '.popover-body'
|
||||
}
|
||||
|
||||
const Event = {
|
||||
HIDE: `hide${EVENT_KEY}`,
|
||||
HIDDEN: `hidden${EVENT_KEY}`,
|
||||
@@ -62,6 +52,12 @@ const Event = {
|
||||
MOUSELEAVE: `mouseleave${EVENT_KEY}`
|
||||
}
|
||||
|
||||
const CLASS_NAME_FADE = 'fade'
|
||||
const CLASS_NAME_SHOW = 'show'
|
||||
|
||||
const SELECTOR_TITLE = '.popover-header'
|
||||
const SELECTOR_CONTENT = '.popover-body'
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Class Definition
|
||||
@@ -109,16 +105,16 @@ class Popover extends Tooltip {
|
||||
const tip = this.getTipElement()
|
||||
|
||||
// we use append for html objects to maintain js events
|
||||
this.setElementContent(SelectorEngine.findOne(Selector.TITLE, tip), this.getTitle())
|
||||
this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle())
|
||||
let content = this._getContent()
|
||||
if (typeof content === 'function') {
|
||||
content = content.call(this.element)
|
||||
}
|
||||
|
||||
this.setElementContent(SelectorEngine.findOne(Selector.CONTENT, tip), content)
|
||||
this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content)
|
||||
|
||||
tip.classList.remove(ClassName.FADE)
|
||||
tip.classList.remove(ClassName.SHOW)
|
||||
tip.classList.remove(CLASS_NAME_FADE)
|
||||
tip.classList.remove(CLASS_NAME_SHOW)
|
||||
}
|
||||
|
||||
_addAttachmentClass(attachment) {
|
||||
|
Reference in New Issue
Block a user