Closed
Bug 324011
Opened 19 years ago
Closed 18 years ago
initMouseEvent does not set relatedTarget property
Categories
(Core :: DOM: Events, defect)
Core
DOM: Events
Tracking
()
RESOLVED
FIXED
People
(Reporter: jasonkarldavis, Assigned: smaug)
References
()
Details
Attachments
(3 files)
5.64 KB,
patch
|
bzbarsky
:
review-
bzbarsky
:
superreview-
|
Details | Diff | Splinter Review |
523 bytes,
text/html
|
Details | |
16.71 KB,
patch
|
jst
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8) Gecko/20051202 Camino/1.0b1+ Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8) Gecko/20051202 Camino/1.0b1+ When calling initMouseEvent() on a newly created event (document.createEvent("MouseEvents")), the related target property is always set to null (regardless of what I provide for arguments). The correct behavior of course would be to have event.relatedTarget equal to whatever the last argument in initMouseEvent was. I can also confirm on Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.9a1) Gecko/20051119 Firefox/1.6a1. Reproducible: Always
Comment 1•19 years ago
|
||
jkd: testcase HTML file? :-)
Comment 2•19 years ago
|
||
Oh ho... nsDOMMouseEvent::InitMouseEvent accepts the argument, but doesn't do anything with it. This one looks easy to fix.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: MacOS X → All
Hardware: Macintosh → All
Comment 3•19 years ago
|
||
This patch fixes the bug and exposes the related target. bz?
Assignee: events → ajvincent
Status: NEW → ASSIGNED
Attachment #208993 -
Flags: superreview?(bzbarsky)
Attachment #208993 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 4•19 years ago
|
||
(In reply to comment #3) > Created an attachment (id=208993) [edit] > patch, v1 > > This patch fixes the bug and exposes the related target. bz? > I don't think this is the right way to fix the problem. If a mouseevent is initialized while there is one event being dispatched, this would change the relatedTarget of that event. And it should be possible to set the relatedTarget even if there is no prescontext.
Comment 5•19 years ago
|
||
Comment on attachment 208993 [details] [diff] [review] patch, v1 No, this is wrong. Consider initing but NOT dispatching an event in an event handler. That will overwrite the relatedTarget of the event you are currently handling. The way to fix this, imo, is to stop the braindamage of storing the relatedTarget in global state in the ESM and just store it in the event itself.
Attachment #208993 -
Flags: superreview?(bzbarsky)
Attachment #208993 -
Flags: superreview-
Attachment #208993 -
Flags: review?(bzbarsky)
Attachment #208993 -
Flags: review-
Comment 6•18 years ago
|
||
Smaug, I haven't thought about this in a while; do you want to take it?
Assignee | ||
Comment 8•18 years ago
|
||
Comment 9•18 years ago
|
||
smaug: I don't think your testcase actually is testing what this bug is about. Per comment 0, the event in question is created by script, not by user actions.
Assignee | ||
Comment 10•18 years ago
|
||
Make mouse and mousescroll events to own relatedTarget. mousescroll events need it only because someone may reinitialize event and (re-)set the related target.
Attachment #228992 -
Flags: superreview?(jst)
Attachment #228992 -
Flags: review?(jst)
Assignee | ||
Comment 11•18 years ago
|
||
(In reply to comment #9) > smaug: I don't think your testcase actually is testing what this bug is about. > Per comment 0, the event in question is created by script, not by user actions. > The javascript: test case is testing relatedTarget when using init*Event, my testcase is just to make sure that the patch works also with "user actions"
Assignee | ||
Updated•18 years ago
|
Status: NEW → ASSIGNED
Comment 12•18 years ago
|
||
Comment on attachment 228992 [details] [diff] [review] proposed patch Looks good, r+sr=jst
Attachment #228992 -
Flags: superreview?(jst)
Attachment #228992 -
Flags: superreview+
Attachment #228992 -
Flags: review?(jst)
Attachment #228992 -
Flags: review+
Assignee | ||
Updated•18 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Comment 13•17 years ago
|
||
Any chance of this getting onto MOZILLA_1_8_BRANCH. This is serious breakage for any listeners that want to use relatedTarget.
Comment 14•17 years ago
|
||
No chance, the patch is changing the event state manager interface, so it could possibly break things if it went into the 1.8 branch. Also, this is not a critical bug (it isn't a crash or a security issue).
You need to log in
before you can comment on or make changes to this bug.
Description
•