From 153cf3a235ec7fd86c09cbe5f31d7eebd0aab661 Mon Sep 17 00:00:00 2001 From: Rohit Sharma Date: Tue, 18 May 2021 11:32:39 +0530 Subject: 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 --- js/src/popover.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'js/src') 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: '' } @@ -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() -- cgit v1.2.3