aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2011-11-08 11:04:26 -0800
committerJacob Thornton <[email protected]>2011-11-08 11:04:26 -0800
commit0c7a80c79bb9a2e1761b4af804050962aac2fe57 (patch)
tree34d748df126104eeec620b573743f212884bfa80
parentb37a336417b0ef447eed78a66762be1ac0f0fba4 (diff)
downloadbootstrap-0c7a80c79bb9a2e1761b4af804050962aac2fe57.tar.xz
bootstrap-0c7a80c79bb9a2e1761b4af804050962aac2fe57.zip
remove selector options for popover, in favor of more generic content selector
-rw-r--r--docs/javascript.html12
-rw-r--r--js/bootstrap-popover.js6
-rw-r--r--js/tests/unit/bootstrap-popover.js23
3 files changed, 2 insertions, 39 deletions
diff --git a/docs/javascript.html b/docs/javascript.html
index 494773512..858345d72 100644
--- a/docs/javascript.html
+++ b/docs/javascript.html
@@ -691,18 +691,6 @@ $('#.tabs').bind('change', function (e) {
<td>[default markup]</td>
<td>the html template used for rendering a popover</td>
</tr>
- <tr>
- <td>titleSelector</td>
- <td>string</td>
- <td>.title</td>
- <td>selector used to find the title element within the popover</td>
- </tr>
- <tr>
- <td>contentSelector</td>
- <td>string</td>
- <td>.content p</td>
- <td>selector used to find the content element within the popover</td>
- </tr>
</tbody>
</table>
<p><span class="label notice">Notice</span> Individual popover instance options can alternatively be specified through the use of data attributes.</code></p>
diff --git a/js/bootstrap-popover.js b/js/bootstrap-popover.js
index e8b49af3c..39fb575bd 100644
--- a/js/bootstrap-popover.js
+++ b/js/bootstrap-popover.js
@@ -36,8 +36,8 @@
setContent: function () {
var $tip = this.tip()
- $tip.find(this.options.titleSelector)[this.options.html ? 'html' : 'text'](this.getTitle())
- $tip.find(this.options.contentSelector)[this.options.html ? 'html' : 'text'](this.getContent())
+ $tip.find('.title')[this.options.html ? 'html' : 'text'](this.getTitle())
+ $tip.find('.content > *')[this.options.html ? 'html' : 'text'](this.getContent())
$tip[0].className = 'popover'
}
@@ -83,8 +83,6 @@
placement: 'right'
, content: 'data-content'
, template: '<div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div>'
- , titleSelector: '.title'
- , contentSelector: '.content p'
})
$.fn.twipsy.rejectAttrOptions.push( 'content' )
diff --git a/js/tests/unit/bootstrap-popover.js b/js/tests/unit/bootstrap-popover.js
index 823526727..2c1483435 100644
--- a/js/tests/unit/bootstrap-popover.js
+++ b/js/tests/unit/bootstrap-popover.js
@@ -73,27 +73,4 @@ $(function () {
$('#qunit-runoff').empty()
})
- test("should allow arbitrary template html with title and content selector options", function() {
- $.support.transition = false
- var expectedTitle = 'Gotta make you understand'
- , popover = $('<a href="#">@rvagg</a>')
- .attr('title', expectedTitle)
- .attr('data-content', '<p><b>Never gonna give you up</b>,</p><p>Never gonna let you down</p>')
- .appendTo('#qunit-runoff')
- .popover({
- html: true
- , titleSelector: 'h1'
- , contentSelector: '.rick > .roll'
- , template: '<div class="rick"><h1></h1><div class="roll"></div></div>'
- })
- .popover('show')
-
- ok($('.popover > div > h1').length, 'h1 tag was inserted')
- ok($('.popover > div > h1').text() === expectedTitle)
- ok($('.popover > .rick > .roll > p').length === 2, 'p > b tags were inserted')
- popover.popover('hide')
- ok(!$('.popover').length, 'popover was removed')
- $('#qunit-runoff').empty()
- })
-
})