diff options
author | GeoSot <geo.sotis@gmail.com> | 2021-06-10 11:00:05 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2021-07-22 17:20:38 +0300 |
commit | da2db218edfc0746c169b567e6a13c9f8e945dda (patch) | |
tree | 24e1771745994b48cd130be382b5879fed342992 /js/src/popover.js | |
parent | 9c3ceaa25b0fcb9b5bd9ff688235e4f3b741026a (diff) |
Use on private method to set content & cleanup template
Diffstat (limited to 'js/src/popover.js')
-rw-r--r-- | js/src/popover.js | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/js/src/popover.js b/js/src/popover.js index 87df36086a..15deaafe23 100644 --- a/js/src/popover.js +++ b/js/src/popover.js @@ -6,7 +6,6 @@ */ import { defineJQueryPlugin } from './util/index' -import SelectorEngine from './dom/selector-engine' import Tooltip from './tooltip' /** @@ -85,35 +84,11 @@ class Popover extends Tooltip { return this.getTitle() || this._getContent() } - getTipElement() { - if (this.tip) { - return this.tip - } - - this.tip = super.getTipElement() - - if (!this.getTitle()) { - SelectorEngine.findOne(SELECTOR_TITLE, this.tip).remove() - } - - if (!this._getContent()) { - SelectorEngine.findOne(SELECTOR_CONTENT, this.tip).remove() - } - - return this.tip - } - setContent() { const tip = this.getTipElement() - // we use append for html objects to maintain js events - this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle()) - let content = this._getContent() - if (typeof content === 'function') { - content = content.call(this._element) - } - - this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content) + this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE) + this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT) } // Private |