mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-18 15:54:26 +01:00
Merge branch '2.1.0-wip' of github.com:twitter/bootstrap into 2.1.0-wip
Conflicts: docs/assets/js/bootstrap.min.js
This commit is contained in:
commit
9a4ee790e1
2
docs/assets/js/bootstrap-carousel.js
vendored
2
docs/assets/js/bootstrap-carousel.js
vendored
@ -46,7 +46,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
, to: function (pos) {
|
, to: function (pos) {
|
||||||
var $active = this.$element.find('.active')
|
var $active = this.$element.find('.item.active')
|
||||||
, children = $active.parent().children()
|
, children = $active.parent().children()
|
||||||
, activePos = children.index($active)
|
, activePos = children.index($active)
|
||||||
, that = this
|
, that = this
|
||||||
|
16
docs/assets/js/bootstrap-typeahead.js
vendored
16
docs/assets/js/bootstrap-typeahead.js
vendored
@ -77,9 +77,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
, lookup: function (event) {
|
, lookup: function (event) {
|
||||||
var that = this
|
var items
|
||||||
, items
|
|
||||||
, q
|
|
||||||
|
|
||||||
this.query = this.$element.val()
|
this.query = this.$element.val()
|
||||||
|
|
||||||
@ -87,7 +85,15 @@
|
|||||||
return this.shown ? this.hide() : this
|
return this.shown ? this.hide() : this
|
||||||
}
|
}
|
||||||
|
|
||||||
items = $.grep(this.source, function (item) {
|
items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source
|
||||||
|
|
||||||
|
return items ? this.process(items) : this
|
||||||
|
}
|
||||||
|
|
||||||
|
, process: function (items) {
|
||||||
|
var that = this
|
||||||
|
|
||||||
|
items = $.grep(items, function (item) {
|
||||||
return that.matcher(item)
|
return that.matcher(item)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -290,4 +296,4 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
}(window.jQuery);
|
}(window.jQuery);
|
||||||
|
18
docs/assets/js/bootstrap.js
vendored
18
docs/assets/js/bootstrap.js
vendored
@ -290,7 +290,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
, to: function (pos) {
|
, to: function (pos) {
|
||||||
var $active = this.$element.find('.active')
|
var $active = this.$element.find('.item.active')
|
||||||
, children = $active.parent().children()
|
, children = $active.parent().children()
|
||||||
, activePos = children.index($active)
|
, activePos = children.index($active)
|
||||||
, that = this
|
, that = this
|
||||||
@ -1676,9 +1676,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
, lookup: function (event) {
|
, lookup: function (event) {
|
||||||
var that = this
|
var items
|
||||||
, items
|
|
||||||
, q
|
|
||||||
|
|
||||||
this.query = this.$element.val()
|
this.query = this.$element.val()
|
||||||
|
|
||||||
@ -1686,7 +1684,15 @@
|
|||||||
return this.shown ? this.hide() : this
|
return this.shown ? this.hide() : this
|
||||||
}
|
}
|
||||||
|
|
||||||
items = $.grep(this.source, function (item) {
|
items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source
|
||||||
|
|
||||||
|
return items ? this.process(items) : this
|
||||||
|
}
|
||||||
|
|
||||||
|
, process: function (items) {
|
||||||
|
var that = this
|
||||||
|
|
||||||
|
items = $.grep(items, function (item) {
|
||||||
return that.matcher(item)
|
return that.matcher(item)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1889,4 +1895,4 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
}(window.jQuery);
|
}(window.jQuery);
|
||||||
|
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
@ -1454,9 +1454,9 @@ $('.carousel').carousel({
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>source</td>
|
<td>source</td>
|
||||||
<td>array</td>
|
<td>array, function</td>
|
||||||
<td>[ ]</td>
|
<td>[ ]</td>
|
||||||
<td>The data source to query against.</td>
|
<td>The data source to query against. May be an array of strings or a function. The function is passed two arguments, the <code>query</code> value in the input field and the <code>process</code> callback. The function may be used synchronously by returning the data source directly or asynchronously via the <code>process</code> callback's single argument.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>items</td>
|
<td>items</td>
|
||||||
@ -1497,6 +1497,7 @@ $('.carousel').carousel({
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
<!-- Footer
|
<!-- Footer
|
||||||
================================================== -->
|
================================================== -->
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
|
6
docs/templates/pages/javascript.mustache
vendored
6
docs/templates/pages/javascript.mustache
vendored
@ -1376,9 +1376,9 @@ $('.carousel').carousel({
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{_i}}source{{/i}}</td>
|
<td>{{_i}}source{{/i}}</td>
|
||||||
<td>{{_i}}array{{/i}}</td>
|
<td>{{_i}}array, function{{/i}}</td>
|
||||||
<td>[ ]</td>
|
<td>[ ]</td>
|
||||||
<td>{{_i}}The data source to query against.{{/i}}</td>
|
<td>{{_i}}The data source to query against. May be an array of strings or a function. The function is passed two arguments, the <code>query</code> value in the input field and the <code>process</code> callback. The function may be used synchronously by returning the data source directly or asynchronously via the <code>process</code> callback's single argument.{{/i}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{_i}}items{{/i}}</td>
|
<td>{{_i}}items{{/i}}</td>
|
||||||
@ -1417,4 +1417,4 @@ $('.carousel').carousel({
|
|||||||
<p>{{_i}}Initializes an input with a typeahead.{{/i}}</p>
|
<p>{{_i}}Initializes an input with a typeahead.{{/i}}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
2
js/bootstrap-carousel.js
vendored
2
js/bootstrap-carousel.js
vendored
@ -46,7 +46,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
, to: function (pos) {
|
, to: function (pos) {
|
||||||
var $active = this.$element.find('.active')
|
var $active = this.$element.find('.item.active')
|
||||||
, children = $active.parent().children()
|
, children = $active.parent().children()
|
||||||
, activePos = children.index($active)
|
, activePos = children.index($active)
|
||||||
, that = this
|
, that = this
|
||||||
|
16
js/bootstrap-typeahead.js
vendored
16
js/bootstrap-typeahead.js
vendored
@ -77,9 +77,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
, lookup: function (event) {
|
, lookup: function (event) {
|
||||||
var that = this
|
var items
|
||||||
, items
|
|
||||||
, q
|
|
||||||
|
|
||||||
this.query = this.$element.val()
|
this.query = this.$element.val()
|
||||||
|
|
||||||
@ -87,7 +85,15 @@
|
|||||||
return this.shown ? this.hide() : this
|
return this.shown ? this.hide() : this
|
||||||
}
|
}
|
||||||
|
|
||||||
items = $.grep(this.source, function (item) {
|
items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source
|
||||||
|
|
||||||
|
return items ? this.process(items) : this
|
||||||
|
}
|
||||||
|
|
||||||
|
, process: function (items) {
|
||||||
|
var that = this
|
||||||
|
|
||||||
|
items = $.grep(items, function (item) {
|
||||||
return that.matcher(item)
|
return that.matcher(item)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -290,4 +296,4 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
}(window.jQuery);
|
}(window.jQuery);
|
||||||
|
36
js/tests/unit/bootstrap-typeahead.js
vendored
36
js/tests/unit/bootstrap-typeahead.js
vendored
@ -52,6 +52,42 @@ $(function () {
|
|||||||
typeahead.$menu.remove()
|
typeahead.$menu.remove()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("should accept data source via synchronous function", function () {
|
||||||
|
var $input = $('<input />').typeahead({
|
||||||
|
source: function () {
|
||||||
|
return ['aa', 'ab', 'ac']
|
||||||
|
}
|
||||||
|
})
|
||||||
|
, typeahead = $input.data('typeahead')
|
||||||
|
|
||||||
|
$input.val('a')
|
||||||
|
typeahead.lookup()
|
||||||
|
|
||||||
|
ok(typeahead.$menu.is(":visible"), 'typeahead is visible')
|
||||||
|
equals(typeahead.$menu.find('li').length, 3, 'has 3 items in menu')
|
||||||
|
equals(typeahead.$menu.find('.active').length, 1, 'one item is active')
|
||||||
|
|
||||||
|
typeahead.$menu.remove()
|
||||||
|
})
|
||||||
|
|
||||||
|
test("should accept data source via asynchronous function", function () {
|
||||||
|
var $input = $('<input />').typeahead({
|
||||||
|
source: function (query, process) {
|
||||||
|
process(['aa', 'ab', 'ac'])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
, typeahead = $input.data('typeahead')
|
||||||
|
|
||||||
|
$input.val('a')
|
||||||
|
typeahead.lookup()
|
||||||
|
|
||||||
|
ok(typeahead.$menu.is(":visible"), 'typeahead is visible')
|
||||||
|
equals(typeahead.$menu.find('li').length, 3, 'has 3 items in menu')
|
||||||
|
equals(typeahead.$menu.find('.active').length, 1, 'one item is active')
|
||||||
|
|
||||||
|
typeahead.$menu.remove()
|
||||||
|
})
|
||||||
|
|
||||||
test("should not explode when regex chars are entered", function () {
|
test("should not explode when regex chars are entered", function () {
|
||||||
var $input = $('<input />').typeahead({
|
var $input = $('<input />').typeahead({
|
||||||
source: ['aa', 'ab', 'ac', 'mdo*', 'fat+']
|
source: ['aa', 'ab', 'ac', 'mdo*', 'fat+']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user