aboutsummaryrefslogtreecommitdiff
path: root/js/src/popover.js
diff options
context:
space:
mode:
authorXhmikosR <[email protected]>2021-10-13 15:19:28 +0300
committerGitHub <[email protected]>2021-10-13 15:19:28 +0300
commite8f702666f285a3e69866ed1f8d29fa6eaaaeabb (patch)
tree944b2dc894f49f8278d41d096e4388e9ac83157b /js/src/popover.js
parentdb44392bda22f3d5319d2880c992f76d27d2a60c (diff)
downloadbootstrap-e8f702666f285a3e69866ed1f8d29fa6eaaaeabb.tar.xz
bootstrap-e8f702666f285a3e69866ed1f8d29fa6eaaaeabb.zip
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
Diffstat (limited to 'js/src/popover.js')
-rw-r--r--js/src/popover.js19
1 files changed, 4 insertions, 15 deletions
diff --git a/js/src/popover.js b/js/src/popover.js
index aa9b0bc9e..144ec1cad 100644
--- a/js/src/popover.js
+++ b/js/src/popover.js
@@ -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)