From 6e732ace2cbb4beff58da86d95e59eeae8410391 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sun, 30 Aug 2015 00:01:30 +0300 Subject: Run `grunt`. [ci skip] --- docs/dist/js/bootstrap.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'docs/dist/js/bootstrap.js') diff --git a/docs/dist/js/bootstrap.js b/docs/dist/js/bootstrap.js index 7d51c641c..bb5199178 100644 --- a/docs/dist/js/bootstrap.js +++ b/docs/dist/js/bootstrap.js @@ -3054,9 +3054,9 @@ var Tooltip = (function ($) { value: function setContent() { var tip = this.getTipElement(); var title = this.getTitle(); - var method = this.config.html ? 'innerHTML' : 'innerText'; + var method = this.config.html ? 'html' : 'text'; - $(tip).find(Selector.TOOLTIP_INNER)[0][method] = title; + $(tip).find(Selector.TOOLTIP_INNER)[method](title); $(tip).removeClass(ClassName.FADE).removeClass(ClassName.IN); @@ -3418,10 +3418,10 @@ var Popover = (function ($) { var tip = this.getTipElement(); var title = this.getTitle(); var content = this._getContent(); - var titleElement = $(tip).find(Selector.TITLE)[0]; + var $titleElement = $(tip).find(Selector.TITLE); - if (titleElement) { - titleElement[this.config.html ? 'innerHTML' : 'innerText'] = title; + if ($titleElement) { + $titleElement[this.config.html ? 'html' : 'text'](title); } // we use append for html objects to maintain js events -- cgit v1.2.3 From f0840c893bafdc9f8cc1adb90ef1282e4618bbd3 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sun, 30 Aug 2015 00:03:55 +0300 Subject: Run `grunt`. --- docs/dist/js/bootstrap.js | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) (limited to 'docs/dist/js/bootstrap.js') diff --git a/docs/dist/js/bootstrap.js b/docs/dist/js/bootstrap.js index bb5199178..42ea8e748 100644 --- a/docs/dist/js/bootstrap.js +++ b/docs/dist/js/bootstrap.js @@ -2058,7 +2058,7 @@ var Modal = (function ($) { 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'; } } }, { @@ -2766,7 +2766,7 @@ var Tooltip = (function ($) { var DefaultType = { animation: 'boolean', template: 'string', - title: '(string|function)', + title: '(string|element|function)', trigger: 'string', delay: '(number|object)', html: 'boolean', @@ -3052,16 +3052,31 @@ var Tooltip = (function ($) { }, { key: 'setContent', value: function setContent() { - var tip = this.getTipElement(); - var title = this.getTitle(); - var method = this.config.html ? 'html' : 'text'; + var $tip = $(this.getTipElement()); - $(tip).find(Selector.TOOLTIP_INNER)[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() { @@ -3351,7 +3366,7 @@ var Popover = (function ($) { }); var DefaultType = $.extend({}, Tooltip.DefaultType, { - content: '(string|function)' + content: '(string|element|function)' }); var ClassName = { @@ -3415,19 +3430,13 @@ var Popover = (function ($) { }, { key: 'setContent', value: function setContent() { - var tip = this.getTipElement(); - var title = this.getTitle(); - var content = this._getContent(); - var $titleElement = $(tip).find(Selector.TITLE); - - if ($titleElement) { - $titleElement[this.config.html ? 'html' : 'text'](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(); } -- cgit v1.2.3