Skip to main content

Bug Tracker

Side navigation

#7009 closed bug (duplicate)

Opened September 07, 2010 10:06AM UTC

Closed September 08, 2010 12:33AM UTC

Inline events are not being canceled by using "return false"

Reported by: Alien003 Owned by:
Priority: Milestone: 1.4.3
Component: event Version: 1.4.2
Keywords: return false PropagationStopped DefaultPrevented Cc:
Blocked by: Blocking:
Description

If in a page there is a event (like onclick) and it ends with a "return false;", if the event is triggered with .click() it still propagates and does the default behavior instead of being canceled.

Its not even the same behavior as clicking the button with the mouse.

I see that the result of those events is being stored in event.result ... so here is my tentative fix:

jQuery.Event.prototype.effectiveResult = function() {

return this.result !== undefined ? !this.result : false;

}

jQuery.Event.prototype.isDefaultPrevented = jQuery.Event.prototype.effectiveResult;

jQuery.Event.prototype.isPropagationStopped = jQuery.Event.prototype.effectiveResult;

jQuery.Event.prototype.isImmediatePropagationStopped = jQuery.Event.prototype.effectiveResult;

Attachments (0)
Change History (1)

Changed September 08, 2010 12:33AM UTC by dmethvin comment:1

resolution: → duplicate
status: newclosed

Dup of #6337; try the patch shown there and see if it fixes things as you expected. If not, reopen this ticket.