mirror of
https://github.com/twbs/bootstrap.git
synced 2024-12-01 13:24:25 +01:00
Merge branch '2.1.1-wip' of github.com:twitter/bootstrap into 2.1.1-wip
This commit is contained in:
commit
545edf5459
4
docs/assets/js/bootstrap-dropdown.js
vendored
4
docs/assets/js/bootstrap-dropdown.js
vendored
@ -110,7 +110,7 @@
|
|||||||
|
|
||||||
if (!selector) {
|
if (!selector) {
|
||||||
selector = $this.attr('href')
|
selector = $this.attr('href')
|
||||||
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
||||||
}
|
}
|
||||||
|
|
||||||
$parent = $(selector)
|
$parent = $(selector)
|
||||||
@ -142,7 +142,7 @@
|
|||||||
$('html')
|
$('html')
|
||||||
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
|
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
|
||||||
$('body')
|
$('body')
|
||||||
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown', function (e) { e.stopPropagation() })
|
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
||||||
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
||||||
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
||||||
})
|
})
|
||||||
|
4
docs/assets/js/bootstrap.js
vendored
4
docs/assets/js/bootstrap.js
vendored
@ -685,7 +685,7 @@
|
|||||||
|
|
||||||
if (!selector) {
|
if (!selector) {
|
||||||
selector = $this.attr('href')
|
selector = $this.attr('href')
|
||||||
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
||||||
}
|
}
|
||||||
|
|
||||||
$parent = $(selector)
|
$parent = $(selector)
|
||||||
@ -717,7 +717,7 @@
|
|||||||
$('html')
|
$('html')
|
||||||
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
|
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
|
||||||
$('body')
|
$('body')
|
||||||
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown', function (e) { e.stopPropagation() })
|
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
||||||
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
||||||
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
||||||
})
|
})
|
||||||
|
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
4
js/bootstrap-dropdown.js
vendored
4
js/bootstrap-dropdown.js
vendored
@ -110,7 +110,7 @@
|
|||||||
|
|
||||||
if (!selector) {
|
if (!selector) {
|
||||||
selector = $this.attr('href')
|
selector = $this.attr('href')
|
||||||
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
||||||
}
|
}
|
||||||
|
|
||||||
$parent = $(selector)
|
$parent = $(selector)
|
||||||
@ -142,7 +142,7 @@
|
|||||||
$('html')
|
$('html')
|
||||||
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
|
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
|
||||||
$('body')
|
$('body')
|
||||||
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown', function (e) { e.stopPropagation() })
|
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
||||||
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
||||||
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
||||||
})
|
})
|
||||||
|
18
js/tests/unit/bootstrap-dropdown.js
vendored
18
js/tests/unit/bootstrap-dropdown.js
vendored
@ -61,6 +61,24 @@ $(function () {
|
|||||||
ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
|
ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("should test if element has a # before assuming it's a selector", function () {
|
||||||
|
var dropdownHTML = '<ul class="tabs">'
|
||||||
|
+ '<li class="dropdown">'
|
||||||
|
+ '<a href="/foo/" 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).find('[data-toggle="dropdown"]').dropdown().click()
|
||||||
|
|
||||||
|
ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
test("should remove open class if body clicked", function () {
|
test("should remove open class if body clicked", function () {
|
||||||
var dropdownHTML = '<ul class="tabs">'
|
var dropdownHTML = '<ul class="tabs">'
|
||||||
+ '<li class="dropdown">'
|
+ '<li class="dropdown">'
|
||||||
|
Loading…
Reference in New Issue
Block a user