Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoSot <geo.sotis@gmail.com>2021-06-10 11:00:05 +0300
committerXhmikosR <xhmikosr@gmail.com>2021-07-22 17:20:38 +0300
commitda2db218edfc0746c169b567e6a13c9f8e945dda (patch)
tree24e1771745994b48cd130be382b5879fed342992 /js/src/tooltip.js
parent9c3ceaa25b0fcb9b5bd9ff688235e4f3b741026a (diff)
Use on private method to set content & cleanup template
Diffstat (limited to 'js/src/tooltip.js')
-rw-r--r--js/src/tooltip.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/js/src/tooltip.js b/js/src/tooltip.js
index fa364a1e68..e09a53b5ce 100644
--- a/js/src/tooltip.js
+++ b/js/src/tooltip.js
@@ -376,8 +376,18 @@ class Tooltip extends BaseComponent {
setContent() {
const tip = this.getTipElement()
- this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle())
- tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW)
+ this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER)
+ }
+
+ _sanitizeAndSetContent(template, content, selector) {
+ const templateElement = SelectorEngine.findOne(selector, template)
+ if (!content) {
+ templateElement.remove()
+ return
+ }
+
+ // we use append for html objects to maintain js events
+ this.setElementContent(templateElement, content)
}
setElementContent(element, content) {