Opened 14 years ago
Last modified 9 years ago
#1365 closed bug
Impossible to return a value other than false or undefined from an event handler — at Initial Version
Reported by: | rformato | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.1.4 |
Component: | event | Version: | 1.1.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Hi, I found that it's impossible to return a value other than false or undefined from an event handler.
In addition it's also useless to set a value for e.returnValue, as the event object is cloned in jQuery.event.fix
So, taking the onbeforeunload event as an example, it is not possible to return a string to show a message to the user before leaving a page.
It should be possible to fix this changing a bit jQuery.event.handle
from
if ( c[j].apply( this, args ) === false ) { event.preventDefault(); event.stopPropagation(); val = false; }
to
if ( (val=c[j].apply( this, args )) === false ) { event.preventDefault(); event.stopPropagation(); }
Note: See
TracTickets for help on using
tickets.