Closed
Bug 191960
Opened 23 years ago
Closed 23 years ago
[FIXr]DOM events cannot be dispatched to nodes not in the document tree
Categories
(Core :: DOM: Events, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
Details
Attachments
(2 files, 1 obsolete file)
|
3.75 KB,
patch
|
Details | Diff | Splinter Review | |
|
3.23 KB,
patch
|
bryner
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
nsEventListenerManager::DispatchEvent gives up and goes home if its target is
not in a document. There's no real reason for it to do that (as far as I can
tell, the Events spec just carefully avoids saying what happens when elements
are not in a document and events get dispatched on them).
Patch coming up, but if we'd rather not do this let me know (and tell me how I
_do_ dispatch an event on an element without explicitly getting a prescontext).
| Assignee | ||
Comment 1•23 years ago
|
||
| Assignee | ||
Updated•23 years ago
|
Attachment #113560 -
Flags: superreview?(jst)
Attachment #113560 -
Flags: review?(bryner)
| Assignee | ||
Updated•23 years ago
|
Summary: DOM events cannot be dispatched to nodes not in the document tree → [FIX]DOM events cannot be dispatched to nodes not in the document tree
Comment 2•23 years ago
|
||
Comment on attachment 113560 [details] [diff] [review]
Proposed fix
//If we don't have a target set this doesn't work.
if (mTarget) {
nsCOMPtr<nsIContent> targetContent(do_QueryInterface(mTarget));
if (targetContent) {
Wanna remove the above redundant if (mTarget) check too while you're poking
around here?
sr=jst
Attachment #113560 -
Flags: superreview?(jst) → superreview+
| Assignee | ||
Comment 3•23 years ago
|
||
| Assignee | ||
Comment 4•23 years ago
|
||
Attachment #113560 -
Attachment is obsolete: true
| Assignee | ||
Updated•23 years ago
|
Attachment #113654 -
Flags: superreview?(jst)
Attachment #113654 -
Flags: review?(bryner)
Comment 5•23 years ago
|
||
Comment on attachment 113654 [details] [diff] [review]
same as diff -w
sr=jst
Attachment #113654 -
Flags: superreview+
| Assignee | ||
Updated•23 years ago
|
Attachment #113654 -
Flags: superreview?(jst)
| Assignee | ||
Updated•23 years ago
|
Attachment #113560 -
Flags: review?(bryner)
Comment 6•23 years ago
|
||
Doing something like this is sort of necessary to implement the spec, which
essentially says that you are supposed to bubble events back to nodes even if
they were removed from the document during the execution of script handlers:
http://www.w3.org/TR/2002/WD-DOM-Level-3-Events-20020712/events.html#Events-flow-capture
"The chain of EventTargets from the top of the tree to the event's target is
determined before the initial dispatch of the event. If modifications occur to
the tree during event processing, event flow will proceed based on the initial
state of the tree."
It really makes sense to do this anyway--elements which capture fired on should
also be bubbled to, and the element which was targeted should always receive the
event that was targeted at it--so making us one step closer to being able to do
it is a Good Thing.
Comment 7•23 years ago
|
||
Comment on attachment 113654 [details] [diff] [review]
same as diff -w
yeah, sounds ok.
Attachment #113654 -
Flags: review?(bryner) → review+
| Assignee | ||
Updated•23 years ago
|
Summary: [FIX]DOM events cannot be dispatched to nodes not in the document tree → [FIXr]DOM events cannot be dispatched to nodes not in the document tree
| Assignee | ||
Comment 8•23 years ago
|
||
checked in for 1.4a.
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
•