From 0c7a80c79bb9a2e1761b4af804050962aac2fe57 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Tue, 8 Nov 2011 11:04:26 -0800 Subject: [PATCH] remove selector options for popover, in favor of more generic content selector --- docs/javascript.html | 12 ------------ js/bootstrap-popover.js | 6 ++---- js/tests/unit/bootstrap-popover.js | 23 ----------------------- 3 files changed, 2 insertions(+), 39 deletions(-) diff --git a/docs/javascript.html b/docs/javascript.html index 4947735123..858345d727 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -691,18 +691,6 @@ $('#.tabs').bind('change', function (e) { [default markup] the html template used for rendering a popover - - titleSelector - string - .title - selector used to find the title element within the popover - - - contentSelector - string - .content p - selector used to find the content element within the popover -

Notice Individual popover instance options can alternatively be specified through the use of data attributes.

diff --git a/js/bootstrap-popover.js b/js/bootstrap-popover.js index e8b49af3c2..39fb575bdb 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: '

' - , 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 823526727f..2c14834359 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 = $('@rvagg') - .attr('title', expectedTitle) - .attr('data-content', '

Never gonna give you up,

Never gonna let you down

') - .appendTo('#qunit-runoff') - .popover({ - html: true - , titleSelector: 'h1' - , contentSelector: '.rick > .roll' - , template: '

' - }) - .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() - }) - })