Closed
Bug 102133
Opened 24 years ago
Closed 23 years ago
Implement phase="target" in XBL
Categories
(Core :: XUL, defect)
Tracking
()
RESOLVED
FIXED
mozilla1.4alpha
People
(Reporter: neil, Assigned: jag+mozilla)
References
()
Details
Attachments
(1 file)
|
28.66 KB,
patch
|
hyatt
:
review+
jag+mozilla
:
superreview+
|
Details | Diff | Splinter Review |
Many XBL event handlers compare event.target to this, to ensure that the event
was targeted at the XBL widget. Surely that's the point of phase="target"? If
not, then feel free to resolve this bug as invalid. But if it is, then I'll come
up with a patch to change all appropriate handlers.
Comment 1•24 years ago
|
||
Hmmm. I'm not sure phase="target" is supported. I also don't think that's what
it means. These values were copying the XHTML events spec. you should go over
there and see what target means.
| Reporter | ||
Comment 2•24 years ago
|
||
Well I had a look at the above URL and it seems to suggest the following:
An event first propagates from the document root to the event target. Capturing
event listeners on the event target or its ancestors will receive the event
during this phase.
An event reaches the event target. This is the target phase. Target event
listeners on the event target will receive the event during this phase.
An event propagates from the event target to the document root. Bubbling event
listeners on the event target or its ancestores will receive the event during
this phase.
Diagrammatically: [root capture] -> [ancestor capture] -> [parent capture] ->
[target capture] -> [target target] -> [target bubble] -> [parent bubble] ->
[ancestor bubble] -> [root bubble]
XBL event handlers appear to default to the bubble phase, so that they receive
events on all their children. For those events for which this is appropriate I
believe the phase should be specified as target.
Comment 3•24 years ago
|
||
Ok, so phase="target" should (in our system) be registered as a non-capturing
event listener that requires event.target to be the same as the element to which
the <handler> is bound?
Comment 4•24 years ago
|
||
This is not implemented in XBL. I'll have to add it.
Status: NEW → ASSIGNED
Summary: Teach people to use phase="target" → Implement phase="target" in XBL
Target Milestone: --- → mozilla1.0
| Reporter | ||
Comment 5•24 years ago
|
||
Dave Hyatt wrote:
> Ok, so phase="target" should (in our system) be registered as a non-capturing
> event listener that requires event.target to be the same as the element to which
> the <handler> is bound?
It should be registered as an event listener which fires after all capturing
event listeners and before all bubbling event listeners. It should only fire on
the target, but I'm not exactly sure how this fits in with anonymous content.
Nor can I read C++ well enough to see how events currently propagate. Do you
suppose that anyone would want to register 3 event handlers for the same event :-)
Comment 6•24 years ago
|
||
That's basically what I said... rememebr that the DOM API addEventLIstener only
gives you two options, to be a capturer or bubbler, so I'll get the same result
by making the event either a capturer or bubbler and just restricting the target.
| Reporter | ||
Comment 7•24 years ago
|
||
I was worried about the order in which events were processed: while capturing
events clearly occur before bubbling events I couldn't determine any
restrictions on event handlers defined on the event target, as the terms
capturing and bubbling are only strictly defined for event handlers on an
ancestor of the target.
Additional note: The doc also suggests that phase="target" should be the default.
Comment 8•24 years ago
|
||
Just poking my head in, not having been following this too closely, but if
the above was a question, then ... there are explictly no guarantees about the
order in which events fire for a given node:
http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-flow-basic
Although all EventListeners on the EventTarget are guaranteed to be
triggered by any event which is received by that EventTarget, no
specification is made as to the order in which they will receive the
event with regards to the other EventListeners on the EventTarget.
| Reporter | ||
Comment 9•24 years ago
|
||
You're only confusing me further...
Just use the condition event.eventPhase = event.AT_TARGET and I'll be happy :-)
Updated•24 years ago
|
Target Milestone: mozilla1.0 → mozilla1.0.1
Comment 10•24 years ago
|
||
*** Bug 108950 has been marked as a duplicate of this bug. ***
Comment 11•24 years ago
|
||
Bug 108950 was incorrectly marked as a duplicate of this bug. It was actually
a duplicate of bug 102113. This has been fixed.
Comment 12•23 years ago
|
||
--> default component owner
Assignee: hyatt → jaggernaut
Status: ASSIGNED → NEW
Target Milestone: mozilla1.0.1 → ---
| Reporter | ||
Comment 13•23 years ago
|
||
| Reporter | ||
Updated•23 years ago
|
Attachment #109819 -
Flags: superreview?(jaggernaut)
Attachment #109819 -
Flags: review?(hyatt)
| Assignee | ||
Comment 14•23 years ago
|
||
I'll let hyatt take a look at this first.
Comment 15•23 years ago
|
||
I think this patch makes sense.
Comment 16•23 years ago
|
||
Comment on attachment 109819 [details] [diff] [review]
Proposed patch
Looks good, and I'm glad you left the default value of mPhase alone.
Bubbling should remain the default for XBL handlers. There would IMO be
extraordinary confusion if XBL handlers used "target" as the default phase, and
that wouldn't be consistent with the idea of handlers being
"filtered/restricted" via attributes.
r=hyatt
Attachment #109819 -
Flags: review?(hyatt) → review+
| Assignee | ||
Comment 17•23 years ago
|
||
Comment on attachment 109819 [details] [diff] [review]
Proposed patch
sr=jag
Attachment #109819 -
Flags: superreview?(jaggernaut) → superreview+
| Reporter | ||
Updated•23 years ago
|
Target Milestone: --- → mozilla1.4alpha
| Reporter | ||
Comment 18•23 years ago
|
||
Checked in a few days ago.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•