mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-20 17:54:23 +01:00
Merge pull request #13173 from twbs/fat-9461
fixes #9461 - Make carousel ignore non-items in carousel-inner
This commit is contained in:
commit
30b14cdc7f
2
dist/js/bootstrap.js
vendored
2
dist/js/bootstrap.js
vendored
@ -302,7 +302,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
|
||||
|
||||
Carousel.prototype.getActiveIndex = function () {
|
||||
this.$active = this.$element.find('.item.active')
|
||||
this.$items = this.$active.parent().children()
|
||||
this.$items = this.$active.parent().children('.item')
|
||||
|
||||
return this.$items.index(this.$active)
|
||||
}
|
||||
|
2
dist/js/bootstrap.min.js
vendored
2
dist/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
4
docs/assets/js/raw-files.min.js
vendored
4
docs/assets/js/raw-files.min.js
vendored
File diff suppressed because one or more lines are too long
2
docs/dist/js/bootstrap.min.js
vendored
2
docs/dist/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
@ -48,7 +48,7 @@
|
||||
|
||||
Carousel.prototype.getActiveIndex = function () {
|
||||
this.$active = this.$element.find('.item.active')
|
||||
this.$items = this.$active.parent().children()
|
||||
this.$items = this.$active.parent().children('.item')
|
||||
|
||||
return this.$items.index(this.$active)
|
||||
}
|
||||
|
@ -107,4 +107,32 @@ $(function () {
|
||||
ok($('#myCarousel').data('bs.carousel').options.interval === false, 'data attribute has higher priority than default options')
|
||||
$('#myCarousel').remove()
|
||||
})
|
||||
|
||||
test('should skip over non-items', function () {
|
||||
$.support.transition = false
|
||||
|
||||
var $template = $(
|
||||
'<div id="myCarousel" class="carousel" data-interval="1814">'
|
||||
+ '<div class="carousel-inner">'
|
||||
+ '<div class="item active">'
|
||||
+ '<img alt="">'
|
||||
+ '</div>'
|
||||
+ '<script type="text/x-metamorph" id="thingy"></script>'
|
||||
+ '<div class="item">'
|
||||
+ '<img alt="">'
|
||||
+ '</div>'
|
||||
+ '<div class="item">'
|
||||
+ '</div>'
|
||||
+ '</div>'
|
||||
+ '</div>'
|
||||
)
|
||||
|
||||
$template.carousel()
|
||||
|
||||
equal($template.find('.item')[0], $template.find('.active')[0], 'the first carousel item should be active')
|
||||
|
||||
$template.carousel(1)
|
||||
|
||||
equal($template.find('.item')[1], $template.find('.active')[0], 'the second carousel item should be active')
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user