Closed Bug 293048 Opened 20 years ago Closed 20 years ago

javascript, Events, stopPropagation() fails

Categories

(Firefox :: General, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: jobelenus, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3

According to your own documentation, stopPropagation() should stop an event from
bubbling up the chain to the next element.

We're having a discussion of the problem here:
http://talideon.com/weblog/2005/03/js-memory-leaks.cfm

Currently, I am attaching an event to "submit" on a form.  The event is caught,
and processing completed.  When I establish that the form did not validate (form
validation is very common for javascript, I am sure you know) I wish to stop the
form from submitting (obviously).

stopPropagation() does NOT stop the form from submitting.  This clearly should
do the job.  Below is a more thorough explanation of how things currently work,
and are said to work.


Reproducible: Always

Steps to Reproduce:
Described above...

Actual Results:  
Form submits

Expected Results:  
Form should not submit

No workarounds at this time (unless degrading to a "lower" (DOM1) form of
javascript is taken)... DOM1 would be something like this:

form onSubmit="return validate()"

Back to DOM2, IE properly stops the propagation by using:

evt.returnValue=false;

Supposedly, there is even another way (which neither Firefox, or IE support):

evt.cancelBubble=true;
Stopping an event's further propagation does not stop the default action. You 
need to use Event.preventDefault().
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.