mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-09 07:06:36 +02:00
Run grunt
.
This commit is contained in:
27
js/dist/tooltip.js
vendored
27
js/dist/tooltip.js
vendored
@@ -43,7 +43,7 @@ var Tooltip = (function ($) {
|
||||
var DefaultType = {
|
||||
animation: 'boolean',
|
||||
template: 'string',
|
||||
title: '(string|function)',
|
||||
title: '(string|element|function)',
|
||||
trigger: 'string',
|
||||
delay: '(number|object)',
|
||||
html: 'boolean',
|
||||
@@ -329,16 +329,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() {
|
||||
|
Reference in New Issue
Block a user