1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-27 05:49:07 +02:00

JS: minor refactoring (#35183)

* add missing comments
* shorten block comments
* reorder constants
* reorder public/private methods
* sort exports alphabetically in util/index.js
* fix a couple of typos
This commit is contained in:
XhmikosR
2021-10-13 15:19:28 +03:00
committed by GitHub
parent db44392bda
commit e8f702666f
21 changed files with 261 additions and 384 deletions

View File

@@ -9,9 +9,7 @@ import { defineJQueryPlugin } from './util/index'
import Tooltip from './tooltip'
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
const NAME = 'popover'
@@ -19,6 +17,9 @@ const DATA_KEY = 'bs.popover'
const EVENT_KEY = `.${DATA_KEY}`
const CLASS_PREFIX = 'bs-popover'
const SELECTOR_TITLE = '.popover-header'
const SELECTOR_CONTENT = '.popover-body'
const Default = {
...Tooltip.Default,
placement: 'right',
@@ -50,18 +51,12 @@ const Event = {
MOUSELEAVE: `mouseleave${EVENT_KEY}`
}
const SELECTOR_TITLE = '.popover-header'
const SELECTOR_CONTENT = '.popover-body'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
* Class definition
*/
class Popover extends Tooltip {
// Getters
static get Default() {
return Default
}
@@ -79,7 +74,6 @@ class Popover extends Tooltip {
}
// Overrides
isWithContent() {
return this.getTitle() || this._getContent()
}
@@ -90,7 +84,6 @@ class Popover extends Tooltip {
}
// Private
_getContent() {
return this._resolvePossibleFunction(this._config.content)
}
@@ -100,7 +93,6 @@ class Popover extends Tooltip {
}
// Static
static jQueryInterface(config) {
return this.each(function () {
const data = Popover.getOrCreateInstance(this, config)
@@ -117,10 +109,7 @@ class Popover extends Tooltip {
}
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
* add .Popover to jQuery only if jQuery is present
*/
defineJQueryPlugin(Popover)