mirror of
https://github.com/twbs/bootstrap.git
synced 2025-04-06 23:57:36 +02:00
Collapse - do not prevent event for input and textarea
This commit is contained in:
parent
8edfe0ff56
commit
24924c23b2
@ -363,7 +363,9 @@ const Collapse = (($) => {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
|
||||||
event.preventDefault()
|
if (/input|textarea/i.test(event.target.tagName)) {
|
||||||
|
event.preventDefault()
|
||||||
|
}
|
||||||
|
|
||||||
const target = Collapse._getTargetFromElement(this)
|
const target = Collapse._getTargetFromElement(this)
|
||||||
const data = $(target).data(DATA_KEY)
|
const data = $(target).data(DATA_KEY)
|
||||||
|
@ -513,4 +513,20 @@ $(function () {
|
|||||||
})
|
})
|
||||||
$target.trigger($.Event('click'))
|
$target.trigger($.Event('click'))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
QUnit.test('should not prevent event for input', function (assert) {
|
||||||
|
assert.expect(2)
|
||||||
|
var done = assert.async()
|
||||||
|
var $target = $('<input type="checkbox" data-toggle="collapse" data-target="#collapsediv1" />').appendTo('#qunit-fixture')
|
||||||
|
|
||||||
|
$('<div id="collapsediv1"/>')
|
||||||
|
.appendTo('#qunit-fixture')
|
||||||
|
.on('shown.bs.collapse', function () {
|
||||||
|
assert.ok($target.attr('aria-expanded') === 'true')
|
||||||
|
assert.ok($target.prop('checked'))
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
|
||||||
|
$target.trigger($.Event('click'))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user