aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2012-06-02 17:55:10 -0700
committerJacob Thornton <[email protected]>2012-06-02 17:55:10 -0700
commitf836473129819c2e348f821ed268451b9b8bf2e4 (patch)
tree5acd7d92391310068375ab10145d3cb8194a1868 /js
parentfc96bc8bba0687fb5845bffc72eb048535583499 (diff)
downloadbootstrap-f836473129819c2e348f821ed268451b9b8bf2e4.tar.xz
bootstrap-f836473129819c2e348f821ed268451b9b8bf2e4.zip
add html option back to tooltip and popover to explicitly prevent XSS #3421
Diffstat (limited to 'js')
-rw-r--r--js/bootstrap-popover.js4
-rw-r--r--js/bootstrap-tooltip.js12
2 files changed, 4 insertions, 12 deletions
diff --git a/js/bootstrap-popover.js b/js/bootstrap-popover.js
index 39fbe358e..c6c1f8b47 100644
--- a/js/bootstrap-popover.js
+++ b/js/bootstrap-popover.js
@@ -43,8 +43,8 @@
, title = this.getTitle()
, content = this.getContent()
- $tip.find('.popover-title')[this.isHTML(title) ? 'html' : 'text'](title)
- $tip.find('.popover-content > *')[this.isHTML(content) ? 'html' : 'text'](content)
+ $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
+ $tip.find('.popover-content > *')[this.options.html ? 'html' : 'text'](content)
$tip.removeClass('fade top bottom left right in')
}
diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js
index b476f1c4e..f5f9fad3f 100644
--- a/js/bootstrap-tooltip.js
+++ b/js/bootstrap-tooltip.js
@@ -148,20 +148,11 @@
}
}
- , 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()
, title = this.getTitle()
- $tip.find('.tooltip-inner')[this.isHTML(title) ? 'html' : 'text'](title)
+ $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
$tip.removeClass('fade in top bottom left right')
}
@@ -270,6 +261,7 @@
, trigger: 'hover'
, title: ''
, delay: 0
+ , html: true
}
}(window.jQuery);