2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-05 16:42:29 +03:00

remake and add isHTML check to popover as well

This commit is contained in:
Jacob Thornton
2012-04-04 15:02:30 -07:00
parent 4bd611884a
commit 83febb3452
5 changed files with 17 additions and 7 deletions
+12 -1
View File
@@ -155,9 +155,20 @@
}
}
, isHTML: function( text ) {
// html string detection logic adapted from jQuery
return typeof text != 'string'
|| ( text.charAt(0) === "<"
&& text.charAt( text.length - 1 ) === ">"
&& text.length >= 3
) || /^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(text)
}
, setContent: function () {
var $tip = this.tip()
$tip.find('.tooltip-inner').html(this.getTitle())
, title = this.getTitle()
$tip.find('.tooltip-inner')[this.isHTML(title) ? 'html' : 'text'](title)
$tip.removeClass('fade in top bottom left right')
}