mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-15 10:05:40 +02:00
Merge branch '3.0.0-wip' of github.com:twitter/bootstrap into 3.0.0-wip
This commit is contained in:
2
docs/assets/css/bootstrap.css
vendored
2
docs/assets/css/bootstrap.css
vendored
@@ -1579,7 +1579,7 @@ select:focus:invalid:focus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.input-group-addon {
|
.input-group-addon {
|
||||||
padding: 6px 8px;
|
padding: 8px 12px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
line-height: 1.428571429;
|
line-height: 1.428571429;
|
||||||
|
63
docs/assets/js/bootstrap.js
vendored
63
docs/assets/js/bootstrap.js
vendored
@@ -433,7 +433,7 @@
|
|||||||
// CAROUSEL DATA-API
|
// CAROUSEL DATA-API
|
||||||
// =================
|
// =================
|
||||||
|
|
||||||
$(document).on('click.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
|
$(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
|
||||||
var $this = $(this), href
|
var $this = $(this), href
|
||||||
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
||||||
var options = $.extend({}, $target.data(), $this.data())
|
var options = $.extend({}, $target.data(), $this.data())
|
||||||
@@ -448,6 +448,13 @@
|
|||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$(window).on('load', function () {
|
||||||
|
$('[data-ride="carousel"]').each(function () {
|
||||||
|
var $carousel = $(this)
|
||||||
|
$carousel.carousel($carousel.data())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
}(window.jQuery);
|
}(window.jQuery);
|
||||||
/* ========================================================================
|
/* ========================================================================
|
||||||
* Bootstrap: collapse.js v3.0.0
|
* Bootstrap: collapse.js v3.0.0
|
||||||
@@ -590,7 +597,7 @@
|
|||||||
// COLLAPSE DATA-API
|
// COLLAPSE DATA-API
|
||||||
// =================
|
// =================
|
||||||
|
|
||||||
$(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
|
$(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
|
||||||
var $this = $(this), href
|
var $this = $(this), href
|
||||||
var target = $this.attr('data-target')
|
var target = $this.attr('data-target')
|
||||||
|| e.preventDefault()
|
|| e.preventDefault()
|
||||||
@@ -630,10 +637,7 @@
|
|||||||
var backdrop = '.dropdown-backdrop'
|
var backdrop = '.dropdown-backdrop'
|
||||||
var toggle = '[data-toggle=dropdown]'
|
var toggle = '[data-toggle=dropdown]'
|
||||||
var Dropdown = function (element) {
|
var Dropdown = function (element) {
|
||||||
var $el = $(element).on('click.dropdown.data-api', this.toggle)
|
var $el = $(element).on('click.bs.dropdown', this.toggle)
|
||||||
$('html').on('click.dropdown.data-api', function () {
|
|
||||||
$el.parent().removeClass('open')
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Dropdown.prototype.toggle = function (e) {
|
Dropdown.prototype.toggle = function (e) {
|
||||||
@@ -651,7 +655,14 @@
|
|||||||
// if mobile we we use a backdrop because click events don't delegate
|
// if mobile we we use a backdrop because click events don't delegate
|
||||||
$('<div class="dropdown-backdrop"/>').insertBefore($(this)).on('click', clearMenus)
|
$('<div class="dropdown-backdrop"/>').insertBefore($(this)).on('click', clearMenus)
|
||||||
}
|
}
|
||||||
$parent.toggleClass('open')
|
|
||||||
|
$parent.trigger(e = $.Event('show.bs.dropdown'))
|
||||||
|
|
||||||
|
if (e.isDefaultPrevented()) return
|
||||||
|
|
||||||
|
$parent
|
||||||
|
.toggleClass('open')
|
||||||
|
.trigger('shown.bs.dropdown')
|
||||||
}
|
}
|
||||||
|
|
||||||
$this.focus()
|
$this.focus()
|
||||||
@@ -692,7 +703,13 @@
|
|||||||
|
|
||||||
function clearMenus() {
|
function clearMenus() {
|
||||||
$(backdrop).remove()
|
$(backdrop).remove()
|
||||||
$(toggle).each(function () { getParent($(this)).removeClass('open') })
|
$(toggle).each(function (e) {
|
||||||
|
var $parent = getParent($(this))
|
||||||
|
if (!$parent.hasClass('open')) return
|
||||||
|
$parent.trigger(e = $.Event('hide.bs.dropdown'))
|
||||||
|
if (e.isDefaultPrevented()) return
|
||||||
|
$parent.removeClass('open').trigger('hidden.bs.dropdown')
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getParent($this) {
|
function getParent($this) {
|
||||||
@@ -741,10 +758,10 @@
|
|||||||
|
|
||||||
|
|
||||||
$(document)
|
$(document)
|
||||||
.on('click.dropdown.data-api', clearMenus)
|
.on('click.bs.dropdown.data-api', clearMenus)
|
||||||
.on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
||||||
.on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
.on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
||||||
.on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
.on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
||||||
|
|
||||||
}(window.jQuery);
|
}(window.jQuery);
|
||||||
/* ========================================================================
|
/* ========================================================================
|
||||||
@@ -825,7 +842,6 @@
|
|||||||
transition ?
|
transition ?
|
||||||
that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown.bs.modal') }) :
|
that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown.bs.modal') }) :
|
||||||
that.$element.focus().trigger('shown.bs.modal')
|
that.$element.focus().trigger('shown.bs.modal')
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -854,7 +870,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Modal.prototype.enforceFocus = function () {
|
Modal.prototype.enforceFocus = function () {
|
||||||
$(document).on('focusin.bs.modal', function (e) {
|
$(document)
|
||||||
|
.off('focusin.bs.modal') // guard against infinite focus loop
|
||||||
|
.on('focusin.bs.modal', function (e) {
|
||||||
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
|
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
|
||||||
this.$element.focus()
|
this.$element.focus()
|
||||||
}
|
}
|
||||||
@@ -1082,7 +1100,7 @@
|
|||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
|
|
||||||
Tooltip.prototype.enter = function (e) {
|
Tooltip.prototype.enter = function (obj) {
|
||||||
var defaults = this.getDefaults()
|
var defaults = this.getDefaults()
|
||||||
var options = {}
|
var options = {}
|
||||||
|
|
||||||
@@ -1090,7 +1108,8 @@
|
|||||||
if (defaults[key] != value) options[key] = value
|
if (defaults[key] != value) options[key] = value
|
||||||
})
|
})
|
||||||
|
|
||||||
var self = $(e.currentTarget)[this.type](options).data('bs.' + this.type)
|
var self = obj instanceof this.constructor ?
|
||||||
|
obj : $(obj.currentTarget)[this.type](options).data('bs.' + this.type)
|
||||||
|
|
||||||
if (!self.options.delay || !self.options.delay.show) return self.show()
|
if (!self.options.delay || !self.options.delay.show) return self.show()
|
||||||
|
|
||||||
@@ -1102,10 +1121,12 @@
|
|||||||
}, self.options.delay.show)
|
}, self.options.delay.show)
|
||||||
}
|
}
|
||||||
|
|
||||||
Tooltip.prototype.leave = function (e) {
|
Tooltip.prototype.leave = function (obj) {
|
||||||
var self = $(e.currentTarget)[this.type](this._options).data('bs.' + this.type)
|
var self = obj instanceof this.constructor ?
|
||||||
|
obj : $(obj.currentTarget)[this.type](this._options).data('bs.' + this.type)
|
||||||
|
|
||||||
|
clearTimeout(this.timeout)
|
||||||
|
|
||||||
if (this.timeout) clearTimeout(this.timeout)
|
|
||||||
if (!self.options.delay || !self.options.delay.hide) return self.hide()
|
if (!self.options.delay || !self.options.delay.hide) return self.hide()
|
||||||
|
|
||||||
self.hoverState = 'out'
|
self.hoverState = 'out'
|
||||||
@@ -1306,7 +1327,7 @@
|
|||||||
|
|
||||||
Tooltip.prototype.toggle = function (e) {
|
Tooltip.prototype.toggle = function (e) {
|
||||||
var self = e ? $(e.currentTarget)[this.type](this._options).data('bs.' + this.type) : this
|
var self = e ? $(e.currentTarget)[this.type](this._options).data('bs.' + this.type) : this
|
||||||
self.tip().hasClass('in') ? self.hide() : self.show()
|
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
Tooltip.prototype.destroy = function () {
|
Tooltip.prototype.destroy = function () {
|
||||||
@@ -1482,7 +1503,7 @@
|
|||||||
var $element = $(element).is('body') ? $(window) : $(element)
|
var $element = $(element).is('body') ? $(window) : $(element)
|
||||||
|
|
||||||
this.$body = $('body')
|
this.$body = $('body')
|
||||||
this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process)
|
this.$scrollElement = $element.on('scroll.bs.scroll-spy.data-api', process)
|
||||||
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
|
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
|
||||||
this.selector = (this.options.target
|
this.selector = (this.options.target
|
||||||
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
||||||
|
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
@@ -347,21 +347,21 @@ $('#myModal').on('hidden.bs.modal', function () {
|
|||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a id="drop1" href="#" role="button" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
|
<a id="drop1" href="#" role="button" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
|
||||||
<ul class="dropdown-menu" role="menu" aria-labelledby="drop1">
|
<ul class="dropdown-menu" role="menu" aria-labelledby="drop1">
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Action</a></li>
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Another action</a></li>
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Something else here</a></li>
|
||||||
<li role="presentation" class="divider"></li>
|
<li role="presentation" class="divider"></li>
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Separated link</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="#" id="drop2" role="button" class="dropdown-toggle" data-toggle="dropdown">Dropdown 2 <b class="caret"></b></a>
|
<a href="#" id="drop2" role="button" class="dropdown-toggle" data-toggle="dropdown">Dropdown 2 <b class="caret"></b></a>
|
||||||
<ul class="dropdown-menu" role="menu" aria-labelledby="drop2">
|
<ul class="dropdown-menu" role="menu" aria-labelledby="drop2">
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Action</a></li>
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Another action</a></li>
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Something else here</a></li>
|
||||||
<li role="presentation" class="divider"></li>
|
<li role="presentation" class="divider"></li>
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Separated link</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -369,11 +369,11 @@ $('#myModal').on('hidden.bs.modal', function () {
|
|||||||
<li id="fat-menu" class="dropdown">
|
<li id="fat-menu" class="dropdown">
|
||||||
<a href="#" id="drop3" role="button" class="dropdown-toggle" data-toggle="dropdown">Dropdown 3 <b class="caret"></b></a>
|
<a href="#" id="drop3" role="button" class="dropdown-toggle" data-toggle="dropdown">Dropdown 3 <b class="caret"></b></a>
|
||||||
<ul class="dropdown-menu" role="menu" aria-labelledby="drop3">
|
<ul class="dropdown-menu" role="menu" aria-labelledby="drop3">
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Action</a></li>
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Another action</a></li>
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Something else here</a></li>
|
||||||
<li role="presentation" class="divider"></li>
|
<li role="presentation" class="divider"></li>
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Separated link</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -389,31 +389,31 @@ $('#myModal').on('hidden.bs.modal', function () {
|
|||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a class="dropdown-toggle" id="drop4" role="button" data-toggle="dropdown" href="#">Dropdown <b class="caret"></b></a>
|
<a class="dropdown-toggle" id="drop4" role="button" data-toggle="dropdown" href="#">Dropdown <b class="caret"></b></a>
|
||||||
<ul id="menu1" class="dropdown-menu" role="menu" aria-labelledby="drop4">
|
<ul id="menu1" class="dropdown-menu" role="menu" aria-labelledby="drop4">
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Action</a></li>
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Another action</a></li>
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Something else here</a></li>
|
||||||
<li role="presentation" class="divider"></li>
|
<li role="presentation" class="divider"></li>
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Separated link</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a class="dropdown-toggle" id="drop5" role="button" data-toggle="dropdown" href="#">Dropdown 2 <b class="caret"></b></a>
|
<a class="dropdown-toggle" id="drop5" role="button" data-toggle="dropdown" href="#">Dropdown 2 <b class="caret"></b></a>
|
||||||
<ul id="menu2" class="dropdown-menu" role="menu" aria-labelledby="drop5">
|
<ul id="menu2" class="dropdown-menu" role="menu" aria-labelledby="drop5">
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Action</a></li>
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Another action</a></li>
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Something else here</a></li>
|
||||||
<li role="presentation" class="divider"></li>
|
<li role="presentation" class="divider"></li>
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Separated link</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a class="dropdown-toggle" id="drop5" role="button" data-toggle="dropdown" href="#">Dropdown 3 <b class="caret"></b></a>
|
<a class="dropdown-toggle" id="drop5" role="button" data-toggle="dropdown" href="#">Dropdown 3 <b class="caret"></b></a>
|
||||||
<ul id="menu3" class="dropdown-menu" role="menu" aria-labelledby="drop5">
|
<ul id="menu3" class="dropdown-menu" role="menu" aria-labelledby="drop5">
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Action</a></li>
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Another action</a></li>
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Something else here</a></li>
|
||||||
<li role="presentation" class="divider"></li>
|
<li role="presentation" class="divider"></li>
|
||||||
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://google.com">Separated link</a></li>
|
<li role="presentation"><a role="menuitem" tabindex="-1" href="http://twitter.com/fat">Separated link</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul> <!-- /tabs -->
|
</ul> <!-- /tabs -->
|
||||||
|
@@ -185,7 +185,7 @@
|
|||||||
// CAROUSEL DATA-API
|
// CAROUSEL DATA-API
|
||||||
// =================
|
// =================
|
||||||
|
|
||||||
$(document).on('click.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
|
$(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
|
||||||
var $this = $(this), href
|
var $this = $(this), href
|
||||||
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
||||||
var options = $.extend({}, $target.data(), $this.data())
|
var options = $.extend({}, $target.data(), $this.data())
|
||||||
@@ -200,4 +200,11 @@
|
|||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$(window).on('load', function () {
|
||||||
|
$('[data-ride="carousel"]').each(function () {
|
||||||
|
var $carousel = $(this)
|
||||||
|
$carousel.carousel($carousel.data())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
}(window.jQuery);
|
}(window.jQuery);
|
||||||
|
@@ -139,7 +139,7 @@
|
|||||||
// COLLAPSE DATA-API
|
// COLLAPSE DATA-API
|
||||||
// =================
|
// =================
|
||||||
|
|
||||||
$(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
|
$(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) {
|
||||||
var $this = $(this), href
|
var $this = $(this), href
|
||||||
var target = $this.attr('data-target')
|
var target = $this.attr('data-target')
|
||||||
|| e.preventDefault()
|
|| e.preventDefault()
|
||||||
|
@@ -26,10 +26,7 @@
|
|||||||
var backdrop = '.dropdown-backdrop'
|
var backdrop = '.dropdown-backdrop'
|
||||||
var toggle = '[data-toggle=dropdown]'
|
var toggle = '[data-toggle=dropdown]'
|
||||||
var Dropdown = function (element) {
|
var Dropdown = function (element) {
|
||||||
var $el = $(element).on('click.dropdown.data-api', this.toggle)
|
var $el = $(element).on('click.bs.dropdown', this.toggle)
|
||||||
$('html').on('click.dropdown.data-api', function () {
|
|
||||||
$el.parent().removeClass('open')
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Dropdown.prototype.toggle = function (e) {
|
Dropdown.prototype.toggle = function (e) {
|
||||||
@@ -47,7 +44,14 @@
|
|||||||
// if mobile we we use a backdrop because click events don't delegate
|
// if mobile we we use a backdrop because click events don't delegate
|
||||||
$('<div class="dropdown-backdrop"/>').insertBefore($(this)).on('click', clearMenus)
|
$('<div class="dropdown-backdrop"/>').insertBefore($(this)).on('click', clearMenus)
|
||||||
}
|
}
|
||||||
$parent.toggleClass('open')
|
|
||||||
|
$parent.trigger(e = $.Event('show.bs.dropdown'))
|
||||||
|
|
||||||
|
if (e.isDefaultPrevented()) return
|
||||||
|
|
||||||
|
$parent
|
||||||
|
.toggleClass('open')
|
||||||
|
.trigger('shown.bs.dropdown')
|
||||||
}
|
}
|
||||||
|
|
||||||
$this.focus()
|
$this.focus()
|
||||||
@@ -88,7 +92,13 @@
|
|||||||
|
|
||||||
function clearMenus() {
|
function clearMenus() {
|
||||||
$(backdrop).remove()
|
$(backdrop).remove()
|
||||||
$(toggle).each(function () { getParent($(this)).removeClass('open') })
|
$(toggle).each(function (e) {
|
||||||
|
var $parent = getParent($(this))
|
||||||
|
if (!$parent.hasClass('open')) return
|
||||||
|
$parent.trigger(e = $.Event('hide.bs.dropdown'))
|
||||||
|
if (e.isDefaultPrevented()) return
|
||||||
|
$parent.removeClass('open').trigger('hidden.bs.dropdown')
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getParent($this) {
|
function getParent($this) {
|
||||||
@@ -137,9 +147,9 @@
|
|||||||
|
|
||||||
|
|
||||||
$(document)
|
$(document)
|
||||||
.on('click.dropdown.data-api', clearMenus)
|
.on('click.bs.dropdown.data-api', clearMenus)
|
||||||
.on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
||||||
.on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
.on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
||||||
.on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
.on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
||||||
|
|
||||||
}(window.jQuery);
|
}(window.jQuery);
|
||||||
|
@@ -76,7 +76,6 @@
|
|||||||
transition ?
|
transition ?
|
||||||
that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown.bs.modal') }) :
|
that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown.bs.modal') }) :
|
||||||
that.$element.focus().trigger('shown.bs.modal')
|
that.$element.focus().trigger('shown.bs.modal')
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +104,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Modal.prototype.enforceFocus = function () {
|
Modal.prototype.enforceFocus = function () {
|
||||||
$(document).on('focusin.bs.modal', function (e) {
|
$(document)
|
||||||
|
.off('focusin.bs.modal') // guard against infinite focus loop
|
||||||
|
.on('focusin.bs.modal', function (e) {
|
||||||
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
|
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
|
||||||
this.$element.focus()
|
this.$element.focus()
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
var $element = $(element).is('body') ? $(window) : $(element)
|
var $element = $(element).is('body') ? $(window) : $(element)
|
||||||
|
|
||||||
this.$body = $('body')
|
this.$body = $('body')
|
||||||
this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process)
|
this.$scrollElement = $element.on('scroll.bs.scroll-spy.data-api', process)
|
||||||
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
|
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
|
||||||
this.selector = (this.options.target
|
this.selector = (this.options.target
|
||||||
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
||||||
|
@@ -149,4 +149,71 @@ $(function () {
|
|||||||
$("#qunit-fixture").html("")
|
$("#qunit-fixture").html("")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("should fire show and hide event", function () {
|
||||||
|
var dropdownHTML = '<ul class="tabs">'
|
||||||
|
+ '<li class="dropdown">'
|
||||||
|
+ '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
|
||||||
|
+ '<ul class="dropdown-menu">'
|
||||||
|
+ '<li><a href="#">Secondary link</a></li>'
|
||||||
|
+ '<li><a href="#">Something else here</a></li>'
|
||||||
|
+ '<li class="divider"></li>'
|
||||||
|
+ '<li><a href="#">Another link</a></li>'
|
||||||
|
+ '</ul>'
|
||||||
|
+ '</li>'
|
||||||
|
+ '</ul>'
|
||||||
|
, dropdown = $(dropdownHTML)
|
||||||
|
.appendTo('#qunit-fixture')
|
||||||
|
.find('[data-toggle="dropdown"]')
|
||||||
|
.dropdown()
|
||||||
|
|
||||||
|
stop()
|
||||||
|
|
||||||
|
dropdown
|
||||||
|
.parent('.dropdown')
|
||||||
|
.bind('show.bs.dropdown', function () {
|
||||||
|
ok(true, 'show was called')
|
||||||
|
})
|
||||||
|
.bind('hide.bs.dropdown', function () {
|
||||||
|
ok(true, 'hide was called')
|
||||||
|
start()
|
||||||
|
})
|
||||||
|
|
||||||
|
dropdown.click()
|
||||||
|
$(document.body).click()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
test("should fire shown and hiden event", function () {
|
||||||
|
var dropdownHTML = '<ul class="tabs">'
|
||||||
|
+ '<li class="dropdown">'
|
||||||
|
+ '<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown</a>'
|
||||||
|
+ '<ul class="dropdown-menu">'
|
||||||
|
+ '<li><a href="#">Secondary link</a></li>'
|
||||||
|
+ '<li><a href="#">Something else here</a></li>'
|
||||||
|
+ '<li class="divider"></li>'
|
||||||
|
+ '<li><a href="#">Another link</a></li>'
|
||||||
|
+ '</ul>'
|
||||||
|
+ '</li>'
|
||||||
|
+ '</ul>'
|
||||||
|
, dropdown = $(dropdownHTML)
|
||||||
|
.appendTo('#qunit-fixture')
|
||||||
|
.find('[data-toggle="dropdown"]')
|
||||||
|
.dropdown()
|
||||||
|
|
||||||
|
stop()
|
||||||
|
|
||||||
|
dropdown
|
||||||
|
.parent('.dropdown')
|
||||||
|
.bind('shown.bs.dropdown', function () {
|
||||||
|
ok(true, 'show was called')
|
||||||
|
})
|
||||||
|
.bind('hidden.bs.dropdown', function () {
|
||||||
|
ok(true, 'hide was called')
|
||||||
|
start()
|
||||||
|
})
|
||||||
|
|
||||||
|
dropdown.click()
|
||||||
|
$(document.body).click()
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@@ -91,7 +91,7 @@
|
|||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
|
|
||||||
Tooltip.prototype.enter = function (e) {
|
Tooltip.prototype.enter = function (obj) {
|
||||||
var defaults = this.getDefaults()
|
var defaults = this.getDefaults()
|
||||||
var options = {}
|
var options = {}
|
||||||
|
|
||||||
@@ -99,7 +99,8 @@
|
|||||||
if (defaults[key] != value) options[key] = value
|
if (defaults[key] != value) options[key] = value
|
||||||
})
|
})
|
||||||
|
|
||||||
var self = $(e.currentTarget)[this.type](options).data('bs.' + this.type)
|
var self = obj instanceof this.constructor ?
|
||||||
|
obj : $(obj.currentTarget)[this.type](options).data('bs.' + this.type)
|
||||||
|
|
||||||
if (!self.options.delay || !self.options.delay.show) return self.show()
|
if (!self.options.delay || !self.options.delay.show) return self.show()
|
||||||
|
|
||||||
@@ -111,10 +112,12 @@
|
|||||||
}, self.options.delay.show)
|
}, self.options.delay.show)
|
||||||
}
|
}
|
||||||
|
|
||||||
Tooltip.prototype.leave = function (e) {
|
Tooltip.prototype.leave = function (obj) {
|
||||||
var self = $(e.currentTarget)[this.type](this._options).data('bs.' + this.type)
|
var self = obj instanceof this.constructor ?
|
||||||
|
obj : $(obj.currentTarget)[this.type](this._options).data('bs.' + this.type)
|
||||||
|
|
||||||
|
clearTimeout(this.timeout)
|
||||||
|
|
||||||
if (this.timeout) clearTimeout(this.timeout)
|
|
||||||
if (!self.options.delay || !self.options.delay.hide) return self.hide()
|
if (!self.options.delay || !self.options.delay.hide) return self.hide()
|
||||||
|
|
||||||
self.hoverState = 'out'
|
self.hoverState = 'out'
|
||||||
@@ -315,7 +318,7 @@
|
|||||||
|
|
||||||
Tooltip.prototype.toggle = function (e) {
|
Tooltip.prototype.toggle = function (e) {
|
||||||
var self = e ? $(e.currentTarget)[this.type](this._options).data('bs.' + this.type) : this
|
var self = e ? $(e.currentTarget)[this.type](this._options).data('bs.' + this.type) : this
|
||||||
self.tip().hasClass('in') ? self.hide() : self.show()
|
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
Tooltip.prototype.destroy = function () {
|
Tooltip.prototype.destroy = function () {
|
||||||
|
@@ -359,7 +359,7 @@ select:focus:invalid {
|
|||||||
// -------------------------
|
// -------------------------
|
||||||
.input-group-addon {
|
.input-group-addon {
|
||||||
.box-sizing(border-box);
|
.box-sizing(border-box);
|
||||||
padding: 6px 8px;
|
padding: @padding-base-vertical @padding-base-horizontal;
|
||||||
font-size: @font-size-base;
|
font-size: @font-size-base;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
line-height: @line-height-base;
|
line-height: @line-height-base;
|
||||||
|
Reference in New Issue
Block a user