0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

on destroy, also hide. issue #3880, pull #4104

This commit is contained in:
Jon Stevens 2012-07-20 09:47:12 -07:00
parent 2ee9b2717b
commit 117f65d431
5 changed files with 8 additions and 2 deletions

View File

@ -786,7 +786,7 @@ $('a[data-toggle="tab"]').on('shown', function (e) {
<p>{{_i}}Toggles an element's tooltip.{{/i}}</p>
<pre class="prettyprint linenums">$('#element').tooltip('toggle')</pre>
<h4>.tooltip('destroy')</h4>
<p>{{_i}}Destroys an element's tooltip.{{/i}}</p>
<p>{{_i}}Hides and destroys an element's tooltip.{{/i}}</p>
<pre class="prettyprint linenums">$('#element').tooltip('destroy')</pre>
</section>
@ -947,7 +947,7 @@ $('a[data-toggle="tab"]').on('shown', function (e) {
<p>{{_i}}Toggles an elements popover.{{/i}}</p>
<pre class="prettyprint linenums">$('#element').popover('toggle')</pre>
<h4>.popover('destroy')</h4>
<p>{{_i}}Destroys an element's popover.{{/i}}</p>
<p>{{_i}}Hides and destroys an element's popover.{{/i}}</p>
<pre class="prettyprint linenums">$('#element').popover('destroy')</pre>
</section>

View File

@ -72,6 +72,7 @@
}
, destroy: function () {
this.hide()
this.$element.off(this.options.ns).removeData('popover')
}

View File

@ -236,6 +236,7 @@
}
, destroy: function () {
this.hide()
this.$element.off(this.options.ns).removeData('tooltip')
}

View File

@ -96,7 +96,9 @@ $(function () {
ok(popover.data('popover'), 'popover has data')
ok(popover.data('events').mouseover && popover.data('events').mouseout, 'popover has hover event')
ok(popover.data('events').click[0].namespace == 'foo', 'popover has extra click.foo event')
popover.popover('show')
popover.popover('destroy')
ok(!popover.hasClass('in'), 'popover is hidden')
ok(!popover.data('popover'), 'popover does not have data')
ok(popover.data('events').click[0].namespace == 'foo', 'popover still has click.foo')
ok(!popover.data('events').mouseover && !popover.data('events').mouseout, 'popover does not have any events')

View File

@ -133,7 +133,9 @@ $(function () {
ok(tooltip.data('tooltip'), 'tooltip has data')
ok(tooltip.data('events').mouseover && tooltip.data('events').mouseout, 'tooltip has hover event')
ok(tooltip.data('events').click[0].namespace == 'foo', 'tooltip has extra click.foo event')
tooltip.tooltip('show')
tooltip.tooltip('destroy')
ok(!tooltip.hasClass('in'), 'tooltip is hidden')
ok(!tooltip.data('tooltip'), 'tooltip does not have data')
ok(tooltip.data('events').click[0].namespace == 'foo', 'tooltip still has click.foo')
ok(!tooltip.data('events').mouseover && !tooltip.data('events').mouseout, 'tooltip does not have any events')