diff options
| author | Alexandr Kondrashov <[email protected]> | 2015-09-11 16:43:00 +0300 |
|---|---|---|
| committer | Alexandr Kondrashov <[email protected]> | 2015-09-11 16:43:00 +0300 |
| commit | c9725926b2f30bed4e37f57c20ef8ffeb2fd233b (patch) | |
| tree | 2964ad7556549dd3e0712bdfdbc5fc4ae7a9b45f /docs/dist/js/umd | |
| parent | 353e0a49a97c24d89f6cdb95014419d4137dee6e (diff) | |
| parent | b811f8cf9628dbcbfe994f71588c5a0c921a092d (diff) | |
| download | bootstrap-c9725926b2f30bed4e37f57c20ef8ffeb2fd233b.tar.xz bootstrap-c9725926b2f30bed4e37f57c20ef8ffeb2fd233b.zip | |
Merge remote-tracking branch 'twbs/v4-dev' into patch-1
Conflicts:
scss/_custom-forms.scss
scss/_variables.scss
Diffstat (limited to 'docs/dist/js/umd')
| -rw-r--r-- | docs/dist/js/umd/modal.js | 2 | ||||
| -rw-r--r-- | docs/dist/js/umd/popover.js | 16 | ||||
| -rw-r--r-- | docs/dist/js/umd/tooltip.js | 27 |
3 files changed, 27 insertions, 18 deletions
diff --git a/docs/dist/js/umd/modal.js b/docs/dist/js/umd/modal.js index bef186f81..6a7ff08e8 100644 --- a/docs/dist/js/umd/modal.js +++ b/docs/dist/js/umd/modal.js @@ -444,7 +444,7 @@ this._originalBodyPadding = document.body.style.paddingRight || ''; if (this._isBodyOverflowing) { - document.body.style.paddingRight = bodyPadding + (this._scrollbarWidth + 'px'); + document.body.style.paddingRight = bodyPadding + this._scrollbarWidth + 'px'; } } }, { diff --git a/docs/dist/js/umd/popover.js b/docs/dist/js/umd/popover.js index e1b56fcfc..057eb0b31 100644 --- a/docs/dist/js/umd/popover.js +++ b/docs/dist/js/umd/popover.js @@ -54,7 +54,7 @@ }); var DefaultType = $.extend({}, _Tooltip2['default'].DefaultType, { - content: '(string|function)' + content: '(string|element|function)' }); var ClassName = { @@ -118,19 +118,13 @@ }, { key: 'setContent', value: function setContent() { - var tip = this.getTipElement(); - var title = this.getTitle(); - var content = this._getContent(); - var titleElement = $(tip).find(Selector.TITLE)[0]; - - if (titleElement) { - titleElement[this.config.html ? 'innerHTML' : 'innerText'] = title; - } + var $tip = $(this.getTipElement()); // we use append for html objects to maintain js events - $(tip).find(Selector.CONTENT).children().detach().end()[this.config.html ? typeof content === 'string' ? 'html' : 'append' : 'text'](content); + this.setElementContent($tip.find(Selector.TITLE), this.getTitle()); + this.setElementContent($tip.find(Selector.CONTENT), this._getContent()); - $(tip).removeClass(ClassName.FADE).removeClass(ClassName.IN); + $tip.removeClass(ClassName.FADE).removeClass(ClassName.IN); this.cleanupTether(); } diff --git a/docs/dist/js/umd/tooltip.js b/docs/dist/js/umd/tooltip.js index 307474d49..96fefe749 100644 --- a/docs/dist/js/umd/tooltip.js +++ b/docs/dist/js/umd/tooltip.js @@ -60,7 +60,7 @@ var DefaultType = { animation: 'boolean', template: 'string', - title: '(string|function)', + title: '(string|element|function)', trigger: 'string', delay: '(number|object)', html: 'boolean', @@ -346,17 +346,32 @@ }, { key: 'setContent', value: function setContent() { - var tip = this.getTipElement(); - var title = this.getTitle(); - var method = this.config.html ? 'innerHTML' : 'innerText'; + var $tip = $(this.getTipElement()); - $(tip).find(Selector.TOOLTIP_INNER)[0][method] = title; + this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle()); - $(tip).removeClass(ClassName.FADE).removeClass(ClassName.IN); + $tip.removeClass(ClassName.FADE).removeClass(ClassName.IN); this.cleanupTether(); } }, { + key: 'setElementContent', + value: function setElementContent($element, content) { + var html = this.config.html; + if (typeof content === 'object' && (content.nodeType || content.jquery)) { + // content is a DOM node or a jQuery + if (html) { + if (!$(content).parent().is($element)) { + $element.empty().append(content); + } + } else { + $element.text($(content).text()); + } + } else { + $element[html ? 'html' : 'text'](content); + } + } + }, { key: 'getTitle', value: function getTitle() { var title = this.element.getAttribute('data-original-title'); |
