mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-01 13:24:25 +01:00
fixes #7776
This commit is contained in:
parent
451acb42db
commit
8cf04911db
23
docs/assets/js/bootstrap.js
vendored
23
docs/assets/js/bootstrap.js
vendored
@ -804,7 +804,7 @@
|
||||
|
||||
var Modal = function (element, options) {
|
||||
this.options = options
|
||||
this.$element = $(element).delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
|
||||
this.$element = $(element).on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
|
||||
this.$backdrop =
|
||||
this.isShown = null
|
||||
|
||||
@ -939,11 +939,12 @@
|
||||
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
||||
.appendTo(document.body)
|
||||
|
||||
this.$backdrop.click(
|
||||
this.options.backdrop == 'static' ?
|
||||
$.proxy(this.$element[0].focus, this.$element[0])
|
||||
: $.proxy(this.hide, this)
|
||||
)
|
||||
this.$element.on('click', $.proxy(function (e) {
|
||||
if (e.target !== e.currentTarget) return
|
||||
this.options.backdrop == 'static'
|
||||
? this.$element[0].focus.call(this.$element[0])
|
||||
: this.hide.call(this)
|
||||
}, this))
|
||||
|
||||
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
|
||||
|
||||
@ -1442,11 +1443,13 @@
|
||||
}
|
||||
|
||||
Popover.prototype.getContent = function () {
|
||||
var content = typeof this.options.content == 'function' ?
|
||||
this.options.content.call(this.$element[0]) :
|
||||
this.options.content
|
||||
var $e = this.$element
|
||||
var o = this.options
|
||||
|
||||
return content || this.$element.attr('data-content')
|
||||
return $e.attr('data-content')
|
||||
|| (typeof o.content == 'function' ?
|
||||
o.content.call($e[0]) :
|
||||
o.content)
|
||||
}
|
||||
|
||||
Popover.prototype.tip = function () {
|
||||
|
2
docs/assets/js/bootstrap.min.js
vendored
2
docs/assets/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
@ -64,11 +64,13 @@
|
||||
}
|
||||
|
||||
Popover.prototype.getContent = function () {
|
||||
var content = typeof this.options.content == 'function' ?
|
||||
this.options.content.call(this.$element[0]) :
|
||||
this.options.content
|
||||
var $e = this.$element
|
||||
var o = this.options
|
||||
|
||||
return content || this.$element.attr('data-content')
|
||||
return $e.attr('data-content')
|
||||
|| (typeof o.content == 'function' ?
|
||||
o.content.call($e[0]) :
|
||||
o.content)
|
||||
}
|
||||
|
||||
Popover.prototype.tip = function () {
|
||||
|
@ -77,6 +77,26 @@ $(function () {
|
||||
$('#qunit-fixture').empty()
|
||||
})
|
||||
|
||||
|
||||
test("should get title and content from attributes #2", function () {
|
||||
$.support.transition = false
|
||||
var popover = $('<a href="#" title="@mdo" data-content="loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻" >@mdo</a>')
|
||||
.appendTo('#qunit-fixture')
|
||||
.popover({
|
||||
title: 'ignored title option',
|
||||
content: 'ignored content option'
|
||||
})
|
||||
.popover('show')
|
||||
|
||||
ok($('.popover').length, 'popover was inserted')
|
||||
equals($('.popover .popover-title').text(), '@mdo', 'title correctly inserted')
|
||||
equals($('.popover .popover-content').text(), "loves data attributes (づ。◕‿‿◕。)づ ︵ ┻━┻", 'content correctly inserted')
|
||||
|
||||
popover.popover('hide')
|
||||
ok(!$('.popover').length, 'popover was removed')
|
||||
$('#qunit-fixture').empty()
|
||||
})
|
||||
|
||||
test("should respect custom classes", function() {
|
||||
$.support.transition = false
|
||||
var popover = $('<a href="#">@fat</a>')
|
||||
|
@ -296,7 +296,7 @@ $(function () {
|
||||
$("head").append('<style> .tooltip.right { white-space: nowrap; } .tooltip.right .tooltip-inner { max-width: none; } </style>')
|
||||
|
||||
var container = $("<div />").appendTo("body")
|
||||
, target = $('<a href="#" rel="tooltip" title="very very very very very very very very long tooltip in one line">To my right</a>')
|
||||
, target = $('<a href="#" rel="tooltip" title="very very very very very very very very long tooltip in one line"></a>')
|
||||
.appendTo(container)
|
||||
.tooltip({placement: 'right'})
|
||||
.tooltip('show')
|
||||
|
Loading…
Reference in New Issue
Block a user