0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-19 16:54:24 +01:00

Merge branch 'master' into 3.0.0-wip

Conflicts:
	docs/assets/css/bootstrap.css
	docs/assets/js/bootstrap.js
	docs/css.html
	docs/templates/pages/base-css.mustache
	docs/templates/pages/components.mustache
	docs/templates/pages/javascript.mustache
	less/breadcrumbs.less
	less/tables.less
	less/tests/css-tests.html
This commit is contained in:
Mark Otto 2012-12-08 17:40:42 -08:00
commit bc0b94a3fd
47 changed files with 693 additions and 112 deletions

View File

@ -700,6 +700,8 @@ pre.prettyprint {
pre code {
padding: 0;
color: inherit;
white-space: pre;
white-space: pre-wrap;
background-color: transparent;
border: 0;
}
@ -1684,6 +1686,10 @@ table {
border-top: 2px solid #dddddd;
}
.table .table {
background-color: #ffffff;
}
.table-condensed th,
.table-condensed td {
padding: 4px 5px;
@ -1713,33 +1719,33 @@ table {
border-top: 0;
}
.table-bordered thead:first-child tr:first-child th:first-child,
.table-bordered tbody:first-child tr:first-child td:first-child {
.table-bordered thead:first-child tr:first-child > th:first-child,
.table-bordered tbody:first-child tr:first-child > td:first-child {
border-top-left-radius: 4px;
}
.table-bordered thead:first-child tr:first-child th:last-child,
.table-bordered tbody:first-child tr:first-child td:last-child {
.table-bordered thead:first-child tr:first-child > th:last-child,
.table-bordered tbody:first-child tr:first-child > td:last-child {
border-top-right-radius: 4px;
}
.table-bordered thead:last-child tr:last-child th:first-child,
.table-bordered tbody:last-child tr:last-child td:first-child,
.table-bordered tfoot:last-child tr:last-child td:first-child {
.table-bordered thead:last-child tr:last-child > th:first-child,
.table-bordered tbody:last-child tr:last-child > td:first-child,
.table-bordered tfoot:last-child tr:last-child > td:first-child {
border-bottom-left-radius: 4px;
}
.table-bordered thead:last-child tr:last-child th:last-child,
.table-bordered tbody:last-child tr:last-child td:last-child,
.table-bordered tfoot:last-child tr:last-child td:last-child {
.table-bordered thead:last-child tr:last-child > th:last-child,
.table-bordered tbody:last-child tr:last-child > td:last-child,
.table-bordered tfoot:last-child tr:last-child > td:last-child {
border-bottom-right-radius: 4px;
}
.table-bordered tfoot + tbody:last-child tr:last-child td:first-child {
.table-bordered tfoot + tbody:last-child tr:last-child > td:first-child {
border-bottom-left-radius: 0;
}
.table-bordered tfoot + tbody:last-child tr:last-child td:last-child {
.table-bordered tfoot + tbody:last-child tr:last-child > td:last-child {
border-bottom-right-radius: 0;
}
@ -1757,8 +1763,8 @@ table {
border-top-right-radius: 4px;
}
.table-striped tbody tr:nth-child(odd) td,
.table-striped tbody tr:nth-child(odd) th {
.table-striped tbody > tr:nth-child(odd) > td,
.table-striped tbody > tr:nth-child(odd) > th {
background-color: #f9f9f9;
}
@ -2827,6 +2833,11 @@ button.close {
border-radius: 3px;
}
.btn-mini [class^="icon-"],
.btn-mini [class*=" icon-"] {
margin-top: -1px;
}
.btn-mini {
padding: 0 6px;
font-size: 10.5px;

View File

@ -68,6 +68,8 @@
/* AFFIX PLUGIN DEFINITION
* ======================= */
var old = $.fn.affix
$.fn.affix = function (option) {
return this.each(function () {
var $this = $(this)
@ -85,6 +87,15 @@
}
/* AFFIX NO CONFLICT
* ================= */
$.fn.affix.noConflict = function () {
$.fn.affix = old
return this
}
/* AFFIX DATA-API
* ============== */

View File

@ -68,6 +68,8 @@
/* ALERT PLUGIN DEFINITION
* ======================= */
var old = $.fn.alert
$.fn.alert = function (option) {
return this.each(function () {
var $this = $(this)
@ -80,6 +82,15 @@
$.fn.alert.Constructor = Alert
/* ALERT NO CONFLICT
* ================= */
$.fn.alert.noConflict = function () {
$.fn.alert = old
return this
}
/* ALERT DATA-API
* ============== */

View File

@ -64,6 +64,8 @@
/* BUTTON PLUGIN DEFINITION
* ======================== */
var old = $.fn.button
$.fn.button = function (option) {
return this.each(function () {
var $this = $(this)
@ -82,6 +84,15 @@
$.fn.button.Constructor = Button
/* BUTTON NO CONFLICT
* ================== */
$.fn.button.noConflict = function () {
$.fn.button = old
return this
}
/* BUTTON DATA-API
* =============== */

View File

@ -29,7 +29,6 @@
var Carousel = function (element, options) {
this.$element = $(element)
this.options = options
this.options.slide && this.slide(this.options.slide)
this.options.pause == 'hover' && this.$element
.on('mouseenter', $.proxy(this.pause, this))
.on('mouseleave', $.proxy(this.cycle, this))
@ -141,6 +140,8 @@
/* CAROUSEL PLUGIN DEFINITION
* ========================== */
var old = $.fn.carousel
$.fn.carousel = function (option) {
return this.each(function () {
var $this = $(this)
@ -162,6 +163,14 @@
$.fn.carousel.Constructor = Carousel
/* CAROUSEL NO CONFLICT
* ==================== */
$.fn.carousel.noConflict = function () {
$.fn.carousel = old
return this
}
/* CAROUSEL DATA-API
* ================= */

View File

@ -120,8 +120,10 @@
}
/* COLLAPSIBLE PLUGIN DEFINITION
* ============================== */
/* COLLAPSE PLUGIN DEFINITION
* ========================== */
var old = $.fn.collapse
$.fn.collapse = function (option) {
return this.each(function () {
@ -140,9 +142,18 @@
$.fn.collapse.Constructor = Collapse
/* COLLAPSIBLE DATA-API
/* COLLAPSE NO CONFLICT
* ==================== */
$.fn.collapse.noConflict = function () {
$.fn.collapse = old
return this
}
/* COLLAPSE DATA-API
* ================= */
$(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
var $this = $(this), href
, target = $this.attr('data-target')

View File

@ -53,9 +53,10 @@
if (!isActive) {
$parent.toggleClass('open')
$this.focus()
}
$this.focus()
return false
}
@ -82,7 +83,7 @@
if (!isActive || (isActive && e.keyCode == 27)) return $this.click()
$items = $('[role=menu] li:not(.divider) a', $parent)
$items = $('[role=menu] li:not(.divider):visible a', $parent)
if (!$items.length) return
@ -124,6 +125,8 @@
/* DROPDOWN PLUGIN DEFINITION
* ========================== */
var old = $.fn.dropdown
$.fn.dropdown = function (option) {
return this.each(function () {
var $this = $(this)
@ -136,6 +139,15 @@
$.fn.dropdown.Constructor = Dropdown
/* DROPDOWN NO CONFLICT
* ==================== */
$.fn.dropdown.noConflict = function () {
$.fn.dropdown = old
return this
}
/* APPLY TO STANDARD DROPDOWN ELEMENTS
* =================================== */

View File

@ -193,6 +193,8 @@
/* MODAL PLUGIN DEFINITION
* ======================= */
var old = $.fn.modal
$.fn.modal = function (option) {
return this.each(function () {
var $this = $(this)
@ -213,6 +215,15 @@
$.fn.modal.Constructor = Modal
/* MODAL NO CONFLICT
* ================= */
$.fn.modal.noConflict = function () {
$.fn.modal = old
return this
}
/* MODAL DATA-API
* ============== */

View File

@ -81,6 +81,8 @@
/* POPOVER PLUGIN DEFINITION
* ======================= */
var old = $.fn.popover
$.fn.popover = function (option) {
return this.each(function () {
var $this = $(this)
@ -100,4 +102,13 @@
, template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"></div></div></div>'
})
/* POPOVER NO CONFLICT
* =================== */
$.fn.popover.noConflict = function () {
$.fn.popover = old
return this
}
}(window.jQuery);

View File

@ -59,7 +59,7 @@
, $href = /^#\w/.test(href) && $(href)
return ( $href
&& $href.length
&& [[ $href.position().top, href ]] ) || null
&& [[ $href.position().top + self.$scrollElement.scrollTop(), href ]] ) || null
})
.sort(function (a, b) { return a[0] - b[0] })
.each(function () {
@ -121,6 +121,8 @@
/* SCROLLSPY PLUGIN DEFINITION
* =========================== */
var old = $.fn.scrollspy
$.fn.scrollspy = function (option) {
return this.each(function () {
var $this = $(this)
@ -138,6 +140,15 @@
}
/* SCROLLSPY NO CONFLICT
* ===================== */
$.fn.scrollspy.noConflict = function () {
$.fn.scrollspy = old
return this
}
/* SCROLLSPY DATA-API
* ================== */

View File

@ -110,6 +110,8 @@
/* TAB PLUGIN DEFINITION
* ===================== */
var old = $.fn.tab
$.fn.tab = function ( option ) {
return this.each(function () {
var $this = $(this)
@ -122,6 +124,15 @@
$.fn.tab.Constructor = Tab
/* TAB NO CONFLICT
* =============== */
$.fn.tab.noConflict = function () {
$.fn.tab = old
return this
}
/* TAB DATA-API
* ============ */

View File

@ -250,6 +250,8 @@
/* TOOLTIP PLUGIN DEFINITION
* ========================= */
var old = $.fn.tooltip
$.fn.tooltip = function ( option ) {
return this.each(function () {
var $this = $(this)
@ -273,4 +275,13 @@
, html: false
}
/* TOOLTIP NO CONFLICT
* =================== */
$.fn.tooltip.noConflict = function () {
$.fn.tooltip = old
return this
}
}(window.jQuery);

View File

@ -33,8 +33,8 @@
this.sorter = this.options.sorter || this.sorter
this.highlighter = this.options.highlighter || this.highlighter
this.updater = this.options.updater || this.updater
this.$menu = $(this.options.menu).appendTo('body')
this.source = this.options.source
this.$menu = $(this.options.menu)
this.shown = false
this.listen()
}
@ -56,16 +56,18 @@
}
, show: function () {
var pos = $.extend({}, this.$element.offset(), {
var pos = $.extend({}, this.$element.position(), {
height: this.$element[0].offsetHeight
})
this.$menu.css({
top: pos.top + pos.height
, left: pos.left
})
this.$menu
.insertAfter(this.$element)
.css({
top: pos.top + pos.height
, left: pos.left
})
.show()
this.$menu.show()
this.shown = true
return this
}
@ -217,7 +219,7 @@
}
, keydown: function (e) {
this.suppressKeyPressRepeat = !~$.inArray(e.keyCode, [40,38,9,13,27])
this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27])
this.move(e)
}
@ -276,6 +278,8 @@
/* TYPEAHEAD PLUGIN DEFINITION
* =========================== */
var old = $.fn.typeahead
$.fn.typeahead = function (option) {
return this.each(function () {
var $this = $(this)
@ -297,7 +301,16 @@
$.fn.typeahead.Constructor = Typeahead
/* TYPEAHEAD DATA-API
/* TYPEAHEAD NO CONFLICT
* =================== */
$.fn.typeahead.noConflict = function () {
$.fn.typeahead = old
return this
}
/* TYPEAHEAD DATA-API
* ================== */
$(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {

View File

@ -127,6 +127,8 @@
/* ALERT PLUGIN DEFINITION
* ======================= */
var old = $.fn.alert
$.fn.alert = function (option) {
return this.each(function () {
var $this = $(this)
@ -139,6 +141,15 @@
$.fn.alert.Constructor = Alert
/* ALERT NO CONFLICT
* ================= */
$.fn.alert.noConflict = function () {
$.fn.alert = old
return this
}
/* ALERT DATA-API
* ============== */
@ -210,6 +221,8 @@
/* BUTTON PLUGIN DEFINITION
* ======================== */
var old = $.fn.button
$.fn.button = function (option) {
return this.each(function () {
var $this = $(this)
@ -228,6 +241,15 @@
$.fn.button.Constructor = Button
/* BUTTON NO CONFLICT
* ================== */
$.fn.button.noConflict = function () {
$.fn.button = old
return this
}
/* BUTTON DATA-API
* =============== */
@ -268,7 +290,6 @@
var Carousel = function (element, options) {
this.$element = $(element)
this.options = options
this.options.slide && this.slide(this.options.slide)
this.options.pause == 'hover' && this.$element
.on('mouseenter', $.proxy(this.pause, this))
.on('mouseleave', $.proxy(this.cycle, this))
@ -380,6 +401,8 @@
/* CAROUSEL PLUGIN DEFINITION
* ========================== */
var old = $.fn.carousel
$.fn.carousel = function (option) {
return this.each(function () {
var $this = $(this)
@ -401,6 +424,14 @@
$.fn.carousel.Constructor = Carousel
/* CAROUSEL NO CONFLICT
* ==================== */
$.fn.carousel.noConflict = function () {
$.fn.carousel = old
return this
}
/* CAROUSEL DATA-API
* ================= */
@ -534,8 +565,10 @@
}
/* COLLAPSIBLE PLUGIN DEFINITION
* ============================== */
/* COLLAPSE PLUGIN DEFINITION
* ========================== */
var old = $.fn.collapse
$.fn.collapse = function (option) {
return this.each(function () {
@ -554,9 +587,18 @@
$.fn.collapse.Constructor = Collapse
/* COLLAPSIBLE DATA-API
/* COLLAPSE NO CONFLICT
* ==================== */
$.fn.collapse.noConflict = function () {
$.fn.collapse = old
return this
}
/* COLLAPSE DATA-API
* ================= */
$(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
var $this = $(this), href
, target = $this.attr('data-target')
@ -622,9 +664,10 @@
if (!isActive) {
$parent.toggleClass('open')
$this.focus()
}
$this.focus()
return false
}
@ -651,7 +694,7 @@
if (!isActive || (isActive && e.keyCode == 27)) return $this.click()
$items = $('[role=menu] li:not(.divider) a', $parent)
$items = $('[role=menu] li:not(.divider):visible a', $parent)
if (!$items.length) return
@ -693,6 +736,8 @@
/* DROPDOWN PLUGIN DEFINITION
* ========================== */
var old = $.fn.dropdown
$.fn.dropdown = function (option) {
return this.each(function () {
var $this = $(this)
@ -705,6 +750,15 @@
$.fn.dropdown.Constructor = Dropdown
/* DROPDOWN NO CONFLICT
* ==================== */
$.fn.dropdown.noConflict = function () {
$.fn.dropdown = old
return this
}
/* APPLY TO STANDARD DROPDOWN ELEMENTS
* =================================== */
@ -910,6 +964,8 @@
/* MODAL PLUGIN DEFINITION
* ======================= */
var old = $.fn.modal
$.fn.modal = function (option) {
return this.each(function () {
var $this = $(this)
@ -930,6 +986,15 @@
$.fn.modal.Constructor = Modal
/* MODAL NO CONFLICT
* ================= */
$.fn.modal.noConflict = function () {
$.fn.modal = old
return this
}
/* MODAL DATA-API
* ============== */
@ -1201,6 +1266,8 @@
/* TOOLTIP PLUGIN DEFINITION
* ========================= */
var old = $.fn.tooltip
$.fn.tooltip = function ( option ) {
return this.each(function () {
var $this = $(this)
@ -1224,6 +1291,15 @@
, html: false
}
/* TOOLTIP NO CONFLICT
* =================== */
$.fn.tooltip.noConflict = function () {
$.fn.tooltip = old
return this
}
}(window.jQuery);/* ===========================================================
* bootstrap-popover.js v3.0.0
* http://twitter.github.com/bootstrap/javascript.html#popovers
@ -1307,6 +1383,8 @@
/* POPOVER PLUGIN DEFINITION
* ======================= */
var old = $.fn.popover
$.fn.popover = function (option) {
return this.each(function () {
var $this = $(this)
@ -1326,6 +1404,15 @@
, template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"></div></div></div>'
})
/* POPOVER NO CONFLICT
* =================== */
$.fn.popover.noConflict = function () {
$.fn.popover = old
return this
}
}(window.jQuery);
/* =============================================================
* bootstrap-scrollspy.js v3.0.0
@ -1388,7 +1475,7 @@
, $href = /^#\w/.test(href) && $(href)
return ( $href
&& $href.length
&& [[ $href.position().top, href ]] ) || null
&& [[ $href.position().top + self.$scrollElement.scrollTop(), href ]] ) || null
})
.sort(function (a, b) { return a[0] - b[0] })
.each(function () {
@ -1450,6 +1537,8 @@
/* SCROLLSPY PLUGIN DEFINITION
* =========================== */
var old = $.fn.scrollspy
$.fn.scrollspy = function (option) {
return this.each(function () {
var $this = $(this)
@ -1467,6 +1556,15 @@
}
/* SCROLLSPY NO CONFLICT
* ===================== */
$.fn.scrollspy.noConflict = function () {
$.fn.scrollspy = old
return this
}
/* SCROLLSPY DATA-API
* ================== */
@ -1589,6 +1687,8 @@
/* TAB PLUGIN DEFINITION
* ===================== */
var old = $.fn.tab
$.fn.tab = function ( option ) {
return this.each(function () {
var $this = $(this)
@ -1601,6 +1701,15 @@
$.fn.tab.Constructor = Tab
/* TAB NO CONFLICT
* =============== */
$.fn.tab.noConflict = function () {
$.fn.tab = old
return this
}
/* TAB DATA-API
* ============ */
@ -1644,8 +1753,8 @@
this.sorter = this.options.sorter || this.sorter
this.highlighter = this.options.highlighter || this.highlighter
this.updater = this.options.updater || this.updater
this.$menu = $(this.options.menu).appendTo('body')
this.source = this.options.source
this.$menu = $(this.options.menu)
this.shown = false
this.listen()
}
@ -1667,16 +1776,18 @@
}
, show: function () {
var pos = $.extend({}, this.$element.offset(), {
var pos = $.extend({}, this.$element.position(), {
height: this.$element[0].offsetHeight
})
this.$menu.css({
top: pos.top + pos.height
, left: pos.left
})
this.$menu
.insertAfter(this.$element)
.css({
top: pos.top + pos.height
, left: pos.left
})
.show()
this.$menu.show()
this.shown = true
return this
}
@ -1828,7 +1939,7 @@
}
, keydown: function (e) {
this.suppressKeyPressRepeat = !~$.inArray(e.keyCode, [40,38,9,13,27])
this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27])
this.move(e)
}
@ -1887,6 +1998,8 @@
/* TYPEAHEAD PLUGIN DEFINITION
* =========================== */
var old = $.fn.typeahead
$.fn.typeahead = function (option) {
return this.each(function () {
var $this = $(this)
@ -1908,7 +2021,16 @@
$.fn.typeahead.Constructor = Typeahead
/* TYPEAHEAD DATA-API
/* TYPEAHEAD NO CONFLICT
* =================== */
$.fn.typeahead.noConflict = function () {
$.fn.typeahead = old
return this
}
/* TYPEAHEAD DATA-API
* ================== */
$(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
@ -1989,6 +2111,8 @@
/* AFFIX PLUGIN DEFINITION
* ======================= */
var old = $.fn.affix
$.fn.affix = function (option) {
return this.each(function () {
var $this = $(this)
@ -2006,6 +2130,15 @@
}
/* AFFIX NO CONFLICT
* ================= */
$.fn.affix.noConflict = function () {
$.fn.affix = old
return this
}
/* AFFIX DATA-API
* ============== */

File diff suppressed because one or more lines are too long

View File

@ -1823,16 +1823,16 @@
</div>
<pre class="prettyprint linenums">
&lt;div class="alert"&gt;
&lt;button type="button" class="close" data-dismiss="alert"&gt;&times;&lt;/button&gt;
&lt;button type="button" class="close" data-dismiss="alert"&gt;&amp;times;&lt;/button&gt;
&lt;strong&gt;Warning!&lt;/strong&gt; Best check yo self, you're not looking too good.
&lt;/div&gt;
</pre>
<h3>Dismiss buttons</h3>
<p>Mobile Safari and Mobile Opera browsers, in addition to the <code>data-dismiss="alert"</code> attribute, require an <code>href="#"</code> for the dismissal of alerts when using an <code>&lt;a&gt;</code> tag.</p>
<pre class="prettyprint linenums">&lt;a href="#" class="close" data-dismiss="alert"&gt;&times;&lt;/a&gt;</pre>
<pre class="prettyprint linenums">&lt;a href="#" class="close" data-dismiss="alert"&gt;&amp;times;&lt;/a&gt;</pre>
<p>Alternatively, you may use a <code>&lt;button&gt;</code> element with the data attribute, which we have opted to do for our docs. When using <code>&lt;button&gt;</code>, you must include <code>type="button"</code> or your forms may not submit.</p>
<pre class="prettyprint linenums">&lt;button type="button" class="close" data-dismiss="alert"&gt;&times;&lt;/button&gt;</pre>
<pre class="prettyprint linenums">&lt;button type="button" class="close" data-dismiss="alert"&gt;&amp;times;&lt;/button&gt;</pre>
<h3>Dismiss alerts via JavaScript</h3>
<p>Use the <a href="./javascript.html#alerts">alerts jQuery plugin</a> for quick and easy dismissal of alerts.</p>
@ -1852,7 +1852,7 @@
</div>
<pre class="prettyprint linenums">
&lt;div class="alert alert-block"&gt;
&lt;button type="button" class="close" data-dismiss="alert"&gt;&times;&lt;/button&gt;
&lt;button type="button" class="close" data-dismiss="alert"&gt;&amp;times;&lt;/button&gt;
&lt;h4&gt;Warning!&lt;/h4&gt;
Best check yo self, you're not...
&lt;/div&gt;

View File

@ -131,9 +131,17 @@ $("#myModal").modal('show') // initializes and invokes show immed
</pre>
<p>Each plugin also exposes its raw constructor on a `Constructor` property: <code>$.fn.popover.Constructor</code>. If you'd like to get a particular plugin instance, retrieve it directly from an element: <code>$('[rel=popover]').data('popover')</code>.</p>
<h3>No conflict</h3>
<p>Sometimes it's neccessary to use bootstrap plugins with other ui frameworks. In these circumstances, occasionally namespace collisions can occur. If this happens, you may call <code>.noCoflict</code> on the plugin you wish to revert the value of.</p>
<pre class="prettyprint linenums">
var bootstrapButton = $.fn.button.noConflict() // return $.fn.button to previously assigned value
$.fn.bootstrapBtn = bootstrapButton // give $().bootstrapBtn the bootstrap functionality
</pre>
<h3>Events</h3>
<p>Bootstrap provides custom events for most plugin's unique actions. Generally, these come in an infinitive and past participle form - where the infinitive (ex. <code>show</code>) is triggered at the start of an event, and its past participle form (ex. <code>shown</code>) is trigger on the completion of an action.</p>
<p>All infinitive events provide preventDefault functionality. This provides the ability to stop the execution of an action before it starts.</p>
<p>All infinitive events provide <code>preventDefault</code> functionality. This provides the ability to stop the execution of an action before it starts.</p>
<pre class="prettyprint linenums">
$('#myModal').on('show', function (e) {
if (!data) return e.preventDefault() // stops modal from being shown
@ -1122,7 +1130,7 @@ $('#my-alert').bind('closed', function () {
<p>Do more with buttons. Control button states or create groups of buttons for more components like toolbars.</p>
<h4>Stateful</h4>
<p>Add data-loading-text="Loading..." to use a loading state on a button.</p>
<p>Add <code>data-loading-text="Loading..."</code> to use a loading state on a button.</p>
<div class="bs-docs-example" style="padding-bottom: 24px;">
<button type="button" id="fat-btn" data-loading-text="loading..." class="btn btn-primary">
Loading state
@ -1131,14 +1139,14 @@ $('#my-alert').bind('closed', function () {
<pre class="prettyprint linenums">&lt;button type="button" class="btn btn-primary" data-loading-text="Loading..."&gt;Loading state&lt;/button&gt;</pre>
<h4>Single toggle</h4>
<p>Add data-toggle="button" to activate toggling on a single button.</p>
<p>Add <code>data-toggle="button"</code> to activate toggling on a single button.</p>
<div class="bs-docs-example" style="padding-bottom: 24px;">
<button type="button" class="btn btn-primary" data-toggle="button">Single Toggle</button>
</div>
<pre class="prettyprint linenums">&lt;button type="button" class="btn btn-primary" data-toggle="button"&gt;Single Toggle&lt;/button&gt;</pre>
<h4>Checkbox</h4>
<p>Add data-toggle="buttons-checkbox" for checkbox style toggling on btn-group.</p>
<p>Add <code>data-toggle="buttons-checkbox"</code> for checkbox style toggling on btn-group.</p>
<div class="bs-docs-example" style="padding-bottom: 24px;">
<div class="btn-group" data-toggle="buttons-checkbox">
<button type="button" class="btn btn-primary">Left</button>
@ -1155,7 +1163,7 @@ $('#my-alert').bind('closed', function () {
</pre>
<h4>Radio</h4>
<p>Add data-toggle="buttons-radio" for radio style toggling on btn-group.</p>
<p>Add <code>data-toggle="buttons-radio"</code> for radio style toggling on btn-group.</p>
<div class="bs-docs-example" style="padding-bottom: 24px;">
<div class="btn-group" data-toggle="buttons-radio">
<button type="button" class="btn btn-primary">Left</button>

View File

@ -1755,16 +1755,16 @@
</div>
<pre class="prettyprint linenums">
&lt;div class="alert"&gt;
&lt;button type="button" class="close" data-dismiss="alert"&gt;&times;&lt;/button&gt;
&lt;button type="button" class="close" data-dismiss="alert"&gt;&amp;times;&lt;/button&gt;
&lt;strong&gt;Warning!&lt;/strong&gt; Best check yo self, you're not looking too good.
&lt;/div&gt;
</pre>
<h3>Dismiss buttons</h3>
<p>Mobile Safari and Mobile Opera browsers, in addition to the <code>data-dismiss="alert"</code> attribute, require an <code>href="#"</code> for the dismissal of alerts when using an <code>&lt;a&gt;</code> tag.</p>
<pre class="prettyprint linenums">&lt;a href="#" class="close" data-dismiss="alert"&gt;&times;&lt;/a&gt;</pre>
<pre class="prettyprint linenums">&lt;a href="#" class="close" data-dismiss="alert"&gt;&amp;times;&lt;/a&gt;</pre>
<p>Alternatively, you may use a <code>&lt;button&gt;</code> element with the data attribute, which we have opted to do for our docs. When using <code>&lt;button&gt;</code>, you must include <code>type="button"</code> or your forms may not submit.</p>
<pre class="prettyprint linenums">&lt;button type="button" class="close" data-dismiss="alert"&gt;&times;&lt;/button&gt;</pre>
<pre class="prettyprint linenums">&lt;button type="button" class="close" data-dismiss="alert"&gt;&amp;times;&lt;/button&gt;</pre>
<h3>Dismiss alerts via JavaScript</h3>
<p>Use the <a href="./javascript.html#alerts">alerts jQuery plugin</a> for quick and easy dismissal of alerts.</p>
@ -1784,7 +1784,7 @@
</div>
<pre class="prettyprint linenums">
&lt;div class="alert alert-block"&gt;
&lt;button type="button" class="close" data-dismiss="alert"&gt;&times;&lt;/button&gt;
&lt;button type="button" class="close" data-dismiss="alert"&gt;&amp;times;&lt;/button&gt;
&lt;h4&gt;Warning!&lt;/h4&gt;
Best check yo self, you're not...
&lt;/div&gt;

View File

@ -63,9 +63,17 @@ $("#myModal").modal('show') // initializes and invokes show immed
</pre>
<p>Each plugin also exposes its raw constructor on a `Constructor` property: <code>$.fn.popover.Constructor</code>. If you'd like to get a particular plugin instance, retrieve it directly from an element: <code>$('[rel=popover]').data('popover')</code>.</p>
<h3>No conflict</h3>
<p>Sometimes it's neccessary to use bootstrap plugins with other ui frameworks. In these circumstances, occasionally namespace collisions can occur. If this happens, you may call <code>.noCoflict</code> on the plugin you wish to revert the value of.</p>
<pre class="prettyprint linenums">
var bootstrapButton = $.fn.button.noConflict() // return $.fn.button to previously assigned value
$.fn.bootstrapBtn = bootstrapButton // give $().bootstrapBtn the bootstrap functionality
</pre>
<h3>Events</h3>
<p>Bootstrap provides custom events for most plugin's unique actions. Generally, these come in an infinitive and past participle form - where the infinitive (ex. <code>show</code>) is triggered at the start of an event, and its past participle form (ex. <code>shown</code>) is trigger on the completion of an action.</p>
<p>All infinitive events provide preventDefault functionality. This provides the ability to stop the execution of an action before it starts.</p>
<p>All infinitive events provide <code>preventDefault</code> functionality. This provides the ability to stop the execution of an action before it starts.</p>
<pre class="prettyprint linenums">
$('#myModal').on('show', function (e) {
if (!data) return e.preventDefault() // stops modal from being shown
@ -1055,7 +1063,7 @@ $('#my-alert').bind('closed', function () {
<p>Do more with buttons. Control button states or create groups of buttons for more components like toolbars.</p>
<h4>Stateful</h4>
<p>Add data-loading-text="Loading..." to use a loading state on a button.</p>
<p>Add <code>data-loading-text="Loading..."</code> to use a loading state on a button.</p>
<div class="bs-docs-example" style="padding-bottom: 24px;">
<button type="button" id="fat-btn" data-loading-text="loading..." class="btn btn-primary">
Loading state
@ -1064,14 +1072,14 @@ $('#my-alert').bind('closed', function () {
<pre class="prettyprint linenums">&lt;button type="button" class="btn btn-primary" data-loading-text="Loading..."&gt;Loading state&lt;/button&gt;</pre>
<h4>Single toggle</h4>
<p>Add data-toggle="button" to activate toggling on a single button.</p>
<p>Add <code>data-toggle="button"</code> to activate toggling on a single button.</p>
<div class="bs-docs-example" style="padding-bottom: 24px;">
<button type="button" class="btn btn-primary" data-toggle="button">Single Toggle</button>
</div>{{! /example }}
<pre class="prettyprint linenums">&lt;button type="button" class="btn btn-primary" data-toggle="button"&gt;Single Toggle&lt;/button&gt;</pre>
<h4>Checkbox</h4>
<p>Add data-toggle="buttons-checkbox" for checkbox style toggling on btn-group.</p>
<p>Add <code>data-toggle="buttons-checkbox"</code> for checkbox style toggling on btn-group.</p>
<div class="bs-docs-example" style="padding-bottom: 24px;">
<div class="btn-group" data-toggle="buttons-checkbox">
<button type="button" class="btn btn-primary">Left</button>
@ -1088,7 +1096,7 @@ $('#my-alert').bind('closed', function () {
</pre>
<h4>Radio</h4>
<p>Add data-toggle="buttons-radio" for radio style toggling on btn-group.</p>
<p>Add <code>data-toggle="buttons-radio"</code> for radio style toggling on btn-group.</p>
<div class="bs-docs-example" style="padding-bottom: 24px;">
<div class="btn-group" data-toggle="buttons-radio">
<button type="button" class="btn btn-primary">Left</button>

11
js/bootstrap-affix.js vendored
View File

@ -68,6 +68,8 @@
/* AFFIX PLUGIN DEFINITION
* ======================= */
var old = $.fn.affix
$.fn.affix = function (option) {
return this.each(function () {
var $this = $(this)
@ -85,6 +87,15 @@
}
/* AFFIX NO CONFLICT
* ================= */
$.fn.affix.noConflict = function () {
$.fn.affix = old
return this
}
/* AFFIX DATA-API
* ============== */

11
js/bootstrap-alert.js vendored
View File

@ -68,6 +68,8 @@
/* ALERT PLUGIN DEFINITION
* ======================= */
var old = $.fn.alert
$.fn.alert = function (option) {
return this.each(function () {
var $this = $(this)
@ -80,6 +82,15 @@
$.fn.alert.Constructor = Alert
/* ALERT NO CONFLICT
* ================= */
$.fn.alert.noConflict = function () {
$.fn.alert = old
return this
}
/* ALERT DATA-API
* ============== */

View File

@ -64,6 +64,8 @@
/* BUTTON PLUGIN DEFINITION
* ======================== */
var old = $.fn.button
$.fn.button = function (option) {
return this.each(function () {
var $this = $(this)
@ -82,6 +84,15 @@
$.fn.button.Constructor = Button
/* BUTTON NO CONFLICT
* ================== */
$.fn.button.noConflict = function () {
$.fn.button = old
return this
}
/* BUTTON DATA-API
* =============== */

View File

@ -29,7 +29,6 @@
var Carousel = function (element, options) {
this.$element = $(element)
this.options = options
this.options.slide && this.slide(this.options.slide)
this.options.pause == 'hover' && this.$element
.on('mouseenter', $.proxy(this.pause, this))
.on('mouseleave', $.proxy(this.cycle, this))
@ -141,6 +140,8 @@
/* CAROUSEL PLUGIN DEFINITION
* ========================== */
var old = $.fn.carousel
$.fn.carousel = function (option) {
return this.each(function () {
var $this = $(this)
@ -162,6 +163,14 @@
$.fn.carousel.Constructor = Carousel
/* CAROUSEL NO CONFLICT
* ==================== */
$.fn.carousel.noConflict = function () {
$.fn.carousel = old
return this
}
/* CAROUSEL DATA-API
* ================= */

View File

@ -120,8 +120,10 @@
}
/* COLLAPSIBLE PLUGIN DEFINITION
* ============================== */
/* COLLAPSE PLUGIN DEFINITION
* ========================== */
var old = $.fn.collapse
$.fn.collapse = function (option) {
return this.each(function () {
@ -140,9 +142,18 @@
$.fn.collapse.Constructor = Collapse
/* COLLAPSIBLE DATA-API
/* COLLAPSE NO CONFLICT
* ==================== */
$.fn.collapse.noConflict = function () {
$.fn.collapse = old
return this
}
/* COLLAPSE DATA-API
* ================= */
$(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
var $this = $(this), href
, target = $this.attr('data-target')

View File

@ -53,9 +53,10 @@
if (!isActive) {
$parent.toggleClass('open')
$this.focus()
}
$this.focus()
return false
}
@ -82,7 +83,7 @@
if (!isActive || (isActive && e.keyCode == 27)) return $this.click()
$items = $('[role=menu] li:not(.divider) a', $parent)
$items = $('[role=menu] li:not(.divider):visible a', $parent)
if (!$items.length) return
@ -124,6 +125,8 @@
/* DROPDOWN PLUGIN DEFINITION
* ========================== */
var old = $.fn.dropdown
$.fn.dropdown = function (option) {
return this.each(function () {
var $this = $(this)
@ -136,6 +139,15 @@
$.fn.dropdown.Constructor = Dropdown
/* DROPDOWN NO CONFLICT
* ==================== */
$.fn.dropdown.noConflict = function () {
$.fn.dropdown = old
return this
}
/* APPLY TO STANDARD DROPDOWN ELEMENTS
* =================================== */

11
js/bootstrap-modal.js vendored
View File

@ -193,6 +193,8 @@
/* MODAL PLUGIN DEFINITION
* ======================= */
var old = $.fn.modal
$.fn.modal = function (option) {
return this.each(function () {
var $this = $(this)
@ -213,6 +215,15 @@
$.fn.modal.Constructor = Modal
/* MODAL NO CONFLICT
* ================= */
$.fn.modal.noConflict = function () {
$.fn.modal = old
return this
}
/* MODAL DATA-API
* ============== */

View File

@ -81,6 +81,8 @@
/* POPOVER PLUGIN DEFINITION
* ======================= */
var old = $.fn.popover
$.fn.popover = function (option) {
return this.each(function () {
var $this = $(this)
@ -100,4 +102,13 @@
, template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"></div></div></div>'
})
/* POPOVER NO CONFLICT
* =================== */
$.fn.popover.noConflict = function () {
$.fn.popover = old
return this
}
}(window.jQuery);

View File

@ -59,7 +59,7 @@
, $href = /^#\w/.test(href) && $(href)
return ( $href
&& $href.length
&& [[ $href.position().top, href ]] ) || null
&& [[ $href.position().top + self.$scrollElement.scrollTop(), href ]] ) || null
})
.sort(function (a, b) { return a[0] - b[0] })
.each(function () {
@ -121,6 +121,8 @@
/* SCROLLSPY PLUGIN DEFINITION
* =========================== */
var old = $.fn.scrollspy
$.fn.scrollspy = function (option) {
return this.each(function () {
var $this = $(this)
@ -138,6 +140,15 @@
}
/* SCROLLSPY NO CONFLICT
* ===================== */
$.fn.scrollspy.noConflict = function () {
$.fn.scrollspy = old
return this
}
/* SCROLLSPY DATA-API
* ================== */

11
js/bootstrap-tab.js vendored
View File

@ -110,6 +110,8 @@
/* TAB PLUGIN DEFINITION
* ===================== */
var old = $.fn.tab
$.fn.tab = function ( option ) {
return this.each(function () {
var $this = $(this)
@ -122,6 +124,15 @@
$.fn.tab.Constructor = Tab
/* TAB NO CONFLICT
* =============== */
$.fn.tab.noConflict = function () {
$.fn.tab = old
return this
}
/* TAB DATA-API
* ============ */

View File

@ -250,6 +250,8 @@
/* TOOLTIP PLUGIN DEFINITION
* ========================= */
var old = $.fn.tooltip
$.fn.tooltip = function ( option ) {
return this.each(function () {
var $this = $(this)
@ -273,4 +275,13 @@
, html: false
}
/* TOOLTIP NO CONFLICT
* =================== */
$.fn.tooltip.noConflict = function () {
$.fn.tooltip = old
return this
}
}(window.jQuery);

View File

@ -33,8 +33,8 @@
this.sorter = this.options.sorter || this.sorter
this.highlighter = this.options.highlighter || this.highlighter
this.updater = this.options.updater || this.updater
this.$menu = $(this.options.menu).appendTo('body')
this.source = this.options.source
this.$menu = $(this.options.menu)
this.shown = false
this.listen()
}
@ -56,16 +56,18 @@
}
, show: function () {
var pos = $.extend({}, this.$element.offset(), {
var pos = $.extend({}, this.$element.position(), {
height: this.$element[0].offsetHeight
})
this.$menu.css({
top: pos.top + pos.height
, left: pos.left
})
this.$menu
.insertAfter(this.$element)
.css({
top: pos.top + pos.height
, left: pos.left
})
.show()
this.$menu.show()
this.shown = true
return this
}
@ -217,7 +219,7 @@
}
, keydown: function (e) {
this.suppressKeyPressRepeat = !~$.inArray(e.keyCode, [40,38,9,13,27])
this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27])
this.move(e)
}
@ -276,6 +278,8 @@
/* TYPEAHEAD PLUGIN DEFINITION
* =========================== */
var old = $.fn.typeahead
$.fn.typeahead = function (option) {
return this.each(function () {
var $this = $(this)
@ -297,7 +301,16 @@
$.fn.typeahead.Constructor = Typeahead
/* TYPEAHEAD DATA-API
/* TYPEAHEAD NO CONFLICT
* =================== */
$.fn.typeahead.noConflict = function () {
$.fn.typeahead = old
return this
}
/* TYPEAHEAD DATA-API
* ================== */
$(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {

View File

@ -2,6 +2,12 @@ $(function () {
module("bootstrap-affix")
test("should provide no conflict", function () {
var affix = $.fn.affix.noConflict()
ok(!$.fn.affix, 'affix was set back to undefined (org value)')
$.fn.affix = affix
})
test("should be defined on jquery object", function () {
ok($(document.body).affix, 'affix method is defined')
})

View File

@ -2,6 +2,12 @@ $(function () {
module("bootstrap-alerts")
test("should provide no conflict", function () {
var alert = $.fn.alert.noConflict()
ok(!$.fn.alert, 'alert was set back to undefined (org value)')
$.fn.alert = alert
})
test("should be defined on jquery object", function () {
ok($(document.body).alert, 'alert method is defined')
})

View File

@ -2,6 +2,12 @@ $(function () {
module("bootstrap-buttons")
test("should provide no conflict", function () {
var button = $.fn.button.noConflict()
ok(!$.fn.button, 'button was set back to undefined (org value)')
$.fn.button = button
})
test("should be defined on jquery object", function () {
ok($(document.body).button, 'button method is defined')
})

View File

@ -2,6 +2,12 @@ $(function () {
module("bootstrap-carousel")
test("should provide no conflict", function () {
var carousel = $.fn.carousel.noConflict()
ok(!$.fn.carousel, 'carousel was set back to undefined (org value)')
$.fn.carousel = carousel
})
test("should be defined on jquery object", function () {
ok($(document.body).carousel, 'carousel method is defined')
})

View File

@ -2,6 +2,12 @@ $(function () {
module("bootstrap-collapse")
test("should provide no conflict", function () {
var collapse = $.fn.collapse.noConflict()
ok(!$.fn.collapse, 'collapse was set back to undefined (org value)')
$.fn.collapse = collapse
})
test("should be defined on jquery object", function () {
ok($(document.body).collapse, 'collapse method is defined')
})

View File

@ -2,6 +2,12 @@ $(function () {
module("bootstrap-dropdowns")
test("should provide no conflict", function () {
var dropdown = $.fn.dropdown.noConflict()
ok(!$.fn.dropdown, 'dropdown was set back to undefined (org value)')
$.fn.dropdown = dropdown
})
test("should be defined on jquery object", function () {
ok($(document.body).dropdown, 'dropdown method is defined')
})
@ -104,7 +110,7 @@ $(function () {
})
test("should remove open class if body clicked, with multiple drop downs", function () {
var dropdownHTML =
var dropdownHTML =
'<ul class="nav">'
+ ' <li><a href="#menu1">Menu 1</a></li>'
+ ' <li class="dropdown" id="testmenu">'
@ -126,7 +132,7 @@ $(function () {
, last = dropdowns.last()
ok(dropdowns.length == 2, "Should be two dropdowns")
first.click()
ok(first.parents('.open').length == 1, 'open class added on click')
ok($('#qunit-fixture .open').length == 1, 'only one object is open')

View File

@ -2,6 +2,12 @@ $(function () {
module("bootstrap-modal")
test("should provide no conflict", function () {
var modal = $.fn.modal.noConflict()
ok(!$.fn.modal, 'modal was set back to undefined (org value)')
$.fn.modal = modal
})
test("should be defined on jquery object", function () {
var div = $("<div id='modal-test'></div>")
ok(div.modal, 'modal method is defined')

View File

@ -2,6 +2,12 @@ $(function () {
module("bootstrap-popover")
test("should provide no conflict", function () {
var popover = $.fn.popover.noConflict()
ok(!$.fn.popover, 'popover was set back to undefined (org value)')
$.fn.popover = popover
})
test("should be defined on jquery object", function () {
var div = $('<div></div>')
ok(div.popover, 'popover method is defined')
@ -70,7 +76,7 @@ $(function () {
ok(!$('.popover').length, 'popover was removed')
$('#qunit-fixture').empty()
})
test("should respect custom classes", function() {
$.support.transition = false
var popover = $('<a href="#">@fat</a>')
@ -80,7 +86,7 @@ $(function () {
, content: 'Test'
, template: '<div class="popover foobar"><div class="arrow"></div><div class="inner"><h3 class="title"></h3><div class="content"><p></p></div></div></div>'
})
popover.popover('show')
ok($('.popover').length, 'popover was inserted')
@ -103,5 +109,5 @@ $(function () {
ok($._data(popover[0],'events').click[0].namespace == 'foo', 'popover still has click.foo')
ok(!$._data(popover[0], 'events').mouseover && !$._data(popover[0], 'events').mouseout, 'popover does not have any events')
})
})

View File

@ -2,6 +2,12 @@ $(function () {
module("bootstrap-scrollspy")
test("should provide no conflict", function () {
var scrollspy = $.fn.scrollspy.noConflict()
ok(!$.fn.scrollspy, 'scrollspy was set back to undefined (org value)')
$.fn.scrollspy = scrollspy
})
test("should be defined on jquery object", function () {
ok($(document.body).scrollspy, 'scrollspy method is defined')
})

View File

@ -2,6 +2,12 @@ $(function () {
module("bootstrap-tabs")
test("should provide no conflict", function () {
var tab = $.fn.tab.noConflict()
ok(!$.fn.tab, 'tab was set back to undefined (org value)')
$.fn.tab = tab
})
test("should be defined on jquery object", function () {
ok($(document.body).tab, 'tabs method is defined')
})

View File

@ -2,6 +2,12 @@ $(function () {
module("bootstrap-tooltip")
test("should provide no conflict", function () {
var tooltip = $.fn.tooltip.noConflict()
ok(!$.fn.tooltip, 'tooltip was set back to undefined (org value)')
$.fn.tooltip = tooltip
})
test("should be defined on jquery object", function () {
var div = $("<div></div>")
ok(div.tooltip, 'popover method is defined')

View File

@ -2,6 +2,12 @@ $(function () {
module("bootstrap-typeahead")
test("should provide no conflict", function () {
var typeahead = $.fn.typeahead.noConflict()
ok(!$.fn.typeahead, 'typeahead was set back to undefined (org value)')
$.fn.typeahead = typeahead
})
test("should be defined on jquery object", function () {
ok($(document.body).typeahead, 'alert method is defined')
})
@ -32,7 +38,9 @@ $(function () {
})
test("should show menu when query entered", function () {
var $input = $('<input />').typeahead({
var $input = $('<input />')
.appendTo('body')
.typeahead({
source: ['aa', 'ab', 'ac']
})
, typeahead = $input.data('typeahead')
@ -44,6 +52,7 @@ $(function () {
equals(typeahead.$menu.find('li').length, 3, 'has 3 items in menu')
equals(typeahead.$menu.find('.active').length, 1, 'one item is active')
$input.remove()
typeahead.$menu.remove()
})
@ -52,7 +61,7 @@ $(function () {
source: function () {
return ['aa', 'ab', 'ac']
}
})
}).appendTo('body')
, typeahead = $input.data('typeahead')
$input.val('a')
@ -62,6 +71,7 @@ $(function () {
equals(typeahead.$menu.find('li').length, 3, 'has 3 items in menu')
equals(typeahead.$menu.find('.active').length, 1, 'one item is active')
$input.remove()
typeahead.$menu.remove()
})
@ -70,7 +80,7 @@ $(function () {
source: function (query, process) {
process(['aa', 'ab', 'ac'])
}
})
}).appendTo('body')
, typeahead = $input.data('typeahead')
$input.val('a')
@ -80,13 +90,14 @@ $(function () {
equals(typeahead.$menu.find('li').length, 3, 'has 3 items in menu')
equals(typeahead.$menu.find('.active').length, 1, 'one item is active')
$input.remove()
typeahead.$menu.remove()
})
test("should not explode when regex chars are entered", function () {
var $input = $('<input />').typeahead({
source: ['aa', 'ab', 'ac', 'mdo*', 'fat+']
})
}).appendTo('body')
, typeahead = $input.data('typeahead')
$input.val('+')
@ -96,6 +107,7 @@ $(function () {
equals(typeahead.$menu.find('li').length, 1, 'has 1 item in menu')
equals(typeahead.$menu.find('.active').length, 1, 'one item is active')
$input.remove()
typeahead.$menu.remove()
})
@ -103,7 +115,7 @@ $(function () {
stop()
var $input = $('<input />').typeahead({
source: ['aa', 'ab', 'ac']
})
}).appendTo('body')
, typeahead = $input.data('typeahead')
$input.val('a')
@ -120,13 +132,14 @@ $(function () {
start()
}, 200)
$input.remove()
typeahead.$menu.remove()
})
test("should set next item when down arrow is pressed", function () {
var $input = $('<input />').typeahead({
source: ['aa', 'ab', 'ac']
})
}).appendTo('body')
, typeahead = $input.data('typeahead')
$input.val('a')
@ -137,21 +150,38 @@ $(function () {
equals(typeahead.$menu.find('.active').length, 1, 'one item is active')
ok(typeahead.$menu.find('li').first().hasClass('active'), "first item is active")
// simulate entire key pressing event
$input.trigger({
type: 'keydown'
, keyCode: 40
})
.trigger({
type: 'keypress'
, keyCode: 40
})
.trigger({
type: 'keyup'
, keyCode: 40
})
ok(typeahead.$menu.find('li').first().next().hasClass('active'), "second item is active")
$input.trigger({
type: 'keydown'
, keyCode: 38
})
.trigger({
type: 'keypress'
, keyCode: 38
})
.trigger({
type: 'keyup'
, keyCode: 38
})
ok(typeahead.$menu.find('li').first().hasClass('active'), "first item is active")
$input.remove()
typeahead.$menu.remove()
})
@ -159,7 +189,7 @@ $(function () {
test("should set input value to selected item", function () {
var $input = $('<input />').typeahead({
source: ['aa', 'ab', 'ac']
})
}).appendTo('body')
, typeahead = $input.data('typeahead')
, changed = false
@ -174,6 +204,7 @@ $(function () {
ok(!typeahead.$menu.is(':visible'), 'the menu was hidden')
ok(changed, 'a change event was fired')
$input.remove()
typeahead.$menu.remove()
})
@ -181,7 +212,7 @@ $(function () {
var $input = $('<input />').typeahead({
source: ['aaaa', 'aaab', 'aaac'],
minLength: 3
})
}).appendTo('body')
, typeahead = $input.data('typeahead')
$input.val('aa')
@ -194,6 +225,7 @@ $(function () {
equals(typeahead.$menu.find('li').length, 3, 'has 3 items in menu')
$input.remove()
typeahead.$menu.remove()
})
})
})

View File

@ -74,6 +74,10 @@
font-size: @font-size-small;
border-radius: @border-radius-small;
}
.btn-mini [class^="icon-"],
.btn-mini [class*=" icon-"] {
margin-top: -1px;
}
// Mini
.btn-mini {

View File

@ -47,6 +47,8 @@ pre {
code {
padding: 0;
color: inherit;
white-space: pre;
white-space: pre-wrap;
background-color: transparent;
border: 0;
}

View File

@ -47,6 +47,11 @@ table {
tbody + tbody {
border-top: 2px solid @table-border;
}
// Nesting
.table {
background-color: @body-background;
}
}
@ -88,35 +93,34 @@ table {
border-top: 0;
}
// For first th or td in the first row in the first thead or tbody
thead:first-child tr:first-child th:first-child,
tbody:first-child tr:first-child td:first-child {
thead:first-child tr:first-child > th:first-child,
tbody:first-child tr:first-child > td:first-child {
border-top-left-radius: @border-radius-base;
}
thead:first-child tr:first-child th:last-child,
tbody:first-child tr:first-child td:last-child {
thead:first-child tr:first-child > th:last-child,
tbody:first-child tr:first-child > td:last-child {
border-top-right-radius: @border-radius-base;
}
// For first th or td in the last row in the last thead or tbody
thead:last-child tr:last-child th:first-child,
tbody:last-child tr:last-child td:first-child,
tfoot:last-child tr:last-child td:first-child {
thead:last-child tr:last-child > th:first-child,
tbody:last-child tr:last-child > td:first-child,
tfoot:last-child tr:last-child > td:first-child {
border-bottom-left-radius: @border-radius-base;
}
thead:last-child tr:last-child th:last-child,
tbody:last-child tr:last-child td:last-child,
tfoot:last-child tr:last-child td:last-child {
thead:last-child tr:last-child > th:last-child,
tbody:last-child tr:last-child > td:last-child,
tfoot:last-child tr:last-child > td:last-child {
border-bottom-right-radius: @border-radius-base;
}
// Clear border-radius for first and last td in the last row in the last tbody for table with tfoot
tfoot + tbody:last-child tr:last-child td:first-child {
tfoot + tbody:last-child tr:last-child > td:first-child {
border-bottom-left-radius: 0;
}
tfoot + tbody:last-child tr:last-child td:last-child {
tfoot + tbody:last-child tr:last-child > td:last-child {
border-bottom-right-radius: 0;
}
// Special fixes to round the left border on the first td/th
caption + thead tr:first-child th:first-child,
caption + tbody tr:first-child td:first-child,
@ -141,8 +145,8 @@ table {
// Default zebra-stripe styles (alternating gray and transparent backgrounds)
.table-striped {
tbody {
tr:nth-child(odd) td,
tr:nth-child(odd) th {
> tr:nth-child(odd) > td,
> tr:nth-child(odd) > th {
background-color: @table-background-accent;
}
}

View File

@ -467,7 +467,54 @@
</div>
</div><!--/row-->
<h4>Nesting and striping</h4>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Test</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Test</th>
<th>Test</th>
</tr>
</thead>
<tbody>
<tr>
<td>
test
</td>
<td>
test
</td>
</tr>
<tr>
<td>
test
</td>
<td>
test
</td>
</tr>
<tr>
<td>
test
</td>
<td>
test
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!-- Forms