aboutsummaryrefslogtreecommitdiff
path: root/js/src
diff options
context:
space:
mode:
authorRohit Sharma <[email protected]>2021-05-18 11:32:39 +0530
committerGitHub <[email protected]>2021-05-18 09:02:39 +0300
commit153cf3a235ec7fd86c09cbe5f31d7eebd0aab661 (patch)
tree30c620c608a4df4eb63cf2d7dcbdc1821b1986d5 /js/src
parent0b2d20b975af55c3df8297d022e8d75b32e303ad (diff)
downloadbootstrap-153cf3a235ec7fd86c09cbe5f31d7eebd0aab661.tar.xz
bootstrap-153cf3a235ec7fd86c09cbe5f31d7eebd0aab661.zip
Don't add empty content holder when there is no content available (#33982)
* Remove content holder when there is no content * Add tests to check the removal of header/content Co-authored-by: XhmikosR <[email protected]>
Diffstat (limited to 'js/src')
-rw-r--r--js/src/popover.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/js/src/popover.js b/js/src/popover.js
index b39985124..6ab31d6e4 100644
--- a/js/src/popover.js
+++ b/js/src/popover.js
@@ -30,7 +30,7 @@ const Default = {
content: '',
template: '<div class="popover" role="tooltip">' +
'<div class="popover-arrow"></div>' +
- '<h3 class="popover-header"></h3>' +
+ '<h3 class="popover-header"></h3>' +
'<div class="popover-body"></div>' +
'</div>'
}
@@ -90,6 +90,24 @@ class Popover extends Tooltip {
return this.getTitle() || this._getContent()
}
+ getTipElement() {
+ if (this.tip) {
+ return this.tip
+ }
+
+ this.tip = super.getTipElement()
+
+ if (!this.getTitle()) {
+ this.tip.removeChild(SelectorEngine.findOne(SELECTOR_TITLE, this.tip))
+ }
+
+ if (!this._getContent()) {
+ this.tip.removeChild(SelectorEngine.findOne(SELECTOR_CONTENT, this.tip))
+ }
+
+ return this.tip
+ }
+
setContent() {
const tip = this.getTipElement()