Closed Bug 105310 Opened 23 years ago Closed 23 years ago

preventCapture() stops bubbling, including event listener on target

Categories

(Core :: DOM: Events, defect)

x86
Windows 98
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 105280

People

(Reporter: WeirdAl, Assigned: joki)

Details

Attachments

(1 file)

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.5) Gecko/20011011
BuildID:    Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.5) Gecko/20011011

The preventCapture() method does not currently allow said Event object to
execute at its target.  It stops the event at the object which the listener is
attached to.

This appears as a bug to me because, when you file the event listener on the
target as a bubbling listener (third argument of addEventListener() as false),
it ignores the target listener and all other bubbly event listeners.

DOM-2 Events states in section 1.2.1:

-- quote --
Although all EventListeners on the EventTarget are guaranteed to be triggered by
any event which is received by that EventTarget...
-- end quote --

There is no indication for preventCapture() to block the bubbling of the event
or any actions on the target.



Reproducible: Always
Steps to Reproduce:
1.  Open the testcase and bonk on the button.

Actual Results:  Two objects "hear" the Event object:  the window and the
document body element, in that order.

Expected Results:  Four objects "hear" the Event object:  the window,
document.body, input element, and document, in that order.

Probably similar to bug 105280.

No matter whether you set the listener at the target input to listen in the
capturing phase or not, the input does not hear the event.

Testcase attached in one moment.
Status: UNCONFIRMED → NEW
Ever confirmed: true
This is a dupe of 105280 at this point but I want to clarify the spec here since
its still relevant in the case for stopPropagation.  The spec does say.

-- quote --
Although all EventListeners on the EventTarget are guaranteed to be triggered by
any event which is received by that EventTarget...
-- end quote --

but the EventTarget it refers to is not event.target but the current EventTarget
which is whatever level the event handler is currently firing at.  So if you
call stopPropagation (or the old preventCapture) at the Document level we will
continue to execute the remaining handlers registered on the Document (the
current EventTarget) and then stop since that is what the call to
stopPropagation requests us to do.  We do not continue to additional EventTargets.



*** This bug has been marked as a duplicate of 105280 ***
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
verifying
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: