Clicking a non-submit type link should allow event propagation
This is useful when an AJAX request link appears inside something like a dropdown. When the link is clicked, the dropdown should close like normal, however this is not the case since the value `false` is returned; so the expected behavior doesn't occur. As a solution, `false` is no longer returned, the default behavior on the event is prevented instead, allowing the propagation to proceed as normal.
This commit is contained in:
parent
805c0939ad
commit
f4b1c586bb
|
|
@ -369,9 +369,13 @@ if (window.jQuery === undefined)
|
|||
$(this).request()
|
||||
})
|
||||
|
||||
$(document).on('click', 'a[data-request], button[data-request], input[type=button][data-request], input[type=submit][data-request]', function documentOnClick() {
|
||||
$(document).on('click', 'a[data-request], button[data-request], input[type=button][data-request], input[type=submit][data-request]', function documentOnClick(e) {
|
||||
e.preventDefault()
|
||||
|
||||
$(this).request()
|
||||
return false
|
||||
|
||||
if ($(this).is('[type=submit]'))
|
||||
return false
|
||||
})
|
||||
|
||||
$(document).on('keydown', 'input[type=text][data-request], input[type=submit][data-request], input[type=password][data-request]', function documentOnKeydown(e) {
|
||||
|
|
@ -385,12 +389,13 @@ if (window.jQuery === undefined)
|
|||
})
|
||||
|
||||
$(document).on('keyup', 'input[data-request][data-track-input]', function documentOnKeyup(e) {
|
||||
if (!$(this).is('[type=email],[type=number],[type=password],[type=search],[type=text]')) return
|
||||
|
||||
var
|
||||
$el = $(this),
|
||||
lastValue = $el.data('oc.lastvalue')
|
||||
|
||||
if (!$el.is('[type=email],[type=number],[type=password],[type=search],[type=text]'))
|
||||
return
|
||||
|
||||
if (lastValue !== undefined && lastValue == this.value)
|
||||
return
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue