1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-12 00:24:03 +02:00

detect if title in tooltip is text or html. if text - use text method to prevent xss.

all add a few notes to js readme about updated event
This commit is contained in:
Jacob Thornton
2012-04-04 14:58:04 -07:00
parent 2dc979a202
commit 4bd611884a
3 changed files with 45 additions and 3 deletions

View File

@@ -59,4 +59,28 @@ $(function () {
ok(!$(".tooltip").length, 'tooltip removed')
})
test("should detect if title string is html or text: foo", function () {
ok(!$.fn.tooltip.Constructor.prototype.isHTML('foo'), 'correctly detected html')
})
test("should detect if title string is html or text: <foo>", function () {
ok(!$.fn.tooltip.Constructor.prototype.isHTML('<foo>'), 'correctly detected html')
})
test("should detect if title string is html or text: <div>foo</div>", function () {
ok($.fn.tooltip.Constructor.prototype.isHTML('<div>foo</div>'), 'correctly detected html')
})
test("should detect if title string is html or text: asdfa&lt;div>foo&lt;/div>asdfasdf", function () {
ok($.fn.tooltip.Constructor.prototype.isHTML('asdfa<div>foo</div>asdfasdf'), 'correctly detected html')
})
test("should detect if title string is html or text: document.createElement('div')", function () {
ok($.fn.tooltip.Constructor.prototype.isHTML(document.createElement('div')), 'correctly detected html')
})
test("should detect if title string is html or text: $('&lt;div />)", function () {
ok($.fn.tooltip.Constructor.prototype.isHTML($('<div></div>')), 'correctly detected html')
})
})