Implement MouseEvent.x / MouseEvent.y (for CSSOM View)

RESOLVED FIXED in Firefox 53

Status

()

Core
DOM: Events
RESOLVED FIXED
9 years ago
9 days ago

People

(Reporter: John Resig, Assigned: Ori Avtalion (salty-horse))

Tracking

(Blocks: 1 bug, {dev-doc-complete})

unspecified
mozilla53
dev-doc-complete
Points:
---

Firefox Tracking Flags

(firefox53 fixed)

Details

(Whiteboard: [parity-chrome][parity-opera][parity-IE][parity-safari][parity-webkit][parity-blink], URL)

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

9 years ago
Currently all browsers implement this property (which is, essentially, clientX and clientY renamed), save for Gecko:
http://www.quirksmode.org/dom/w3c_cssom.html#mousepos

Adding this would help improve cross-browser compatibility and help us comply with CSSOM:
http://www.w3.org/TR/cssom-view/
According to: http://msdn2.microsoft.com/en-us/library/ms535863(VS.85).aspx
"
y	Sets or retrieves the y-coordinate, in pixels, of the mouse pointer's position relative to a relatively positioned parent element.
"
"
clientY	Sets or retrieves the y-coordinate of the mouse pointer's position relative to the client area of the window, excluding window decorations and scroll bars.
"
So there seems to be a real difference between .y and .clientY, afaict. Unless the msdn documentation is wrong (which I doubt).

Comment 2

9 years ago
I'm not at all sure we should implement .x/.y, they are just aliases to
clientX/Y. I might even propose to remove .x/.y from the spec.
http://dev.w3.org/csswg/cssom-view/#the-mouseeventview-interface
(Assignee)

Comment 3

6 months ago
Years have passed, and .x/.y remain in the CSSOM draft. Is there still resistance to implementing this?

https://drafts.csswg.org/cssom-view/#dom-mouseevent-x

Updated

6 months ago
Duplicate of this bug: 1202113

Updated

6 months ago
Summary: Implement event.x / event.y (for CSSOM) → Implement MouseEvent.x / MouseEvent.y (for CSSOM View)
Whiteboard: [parity-chrome][parity-opera][parity-IE][parity-safari][parity-webkit][parity-blink]
Kan-Ru, I wonder what you think about this question, as the module owner - it came up on the #qa channel recently.
Flags: needinfo?(kchen)
(Assignee)

Comment 6

6 months ago
Created attachment 8806536 [details] [diff] [review]
Patch with tests
Attachment #8806536 - Flags: review?(bugs)
(In reply to Liz Henry (:lizzard) (needinfo? me) from comment #5)
> Kan-Ru, I wonder what you think about this question, as the module owner -
> it came up on the #qa channel recently.

I think Olli's opinion matters more.. Note I'm not a module owner of DOM::Events; did you meant to comment this bug?

IMO we have not have .x/.y for this long and we are still doing fine so maybe change this won't improve webcompat very much. Though implementing them wouldn't hurt either.
Flags: needinfo?(kchen)
(Assignee)

Comment 8

6 months ago
(In reply to Kan-Ru Chen [:kanru] (UTC+8) from comment #7)
> IMO we have not have .x/.y for this long and we are still doing fine so
> maybe change this won't improve webcompat very much. Though implementing
> them wouldn't hurt either.
I revived this after encountering a page that was broken on Firefox.

Comment 9

6 months ago
Comment on attachment 8806536 [details] [diff] [review]
Patch with tests

not sure why dispatchEvent is needed, but fine.
Attachment #8806536 - Flags: review?(bugs) → review+
(Assignee)

Comment 10

6 months ago
(In reply to Olli Pettay [:smaug] from comment #9)
> not sure why dispatchEvent is needed, but fine.
I can change it. Is it enough to call the MouseEvent constructor and check x/y?

Comment 11

6 months ago
I think that should be enough there.
(Assignee)

Comment 12

6 months ago
Created attachment 8806861 [details] [diff] [review]
Patch with simpler tests and commit metadata
Assignee: nobody → ori
Attachment #8806536 - Attachment is obsolete: true
Attachment #8806861 - Flags: review?(bugs)

Updated

6 months ago
Attachment #8806861 - Flags: review?(bugs) → review+
(Assignee)

Updated

6 months ago
Keywords: checkin-needed

Comment 13

6 months ago
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/e8c6f15ad696
Implement MouseEvent.x / MouseEvent.y (for CSSOM View). r=smaug
Keywords: checkin-needed
Keywords: dev-doc-needed

Comment 14

5 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/e8c6f15ad696
Status: NEW → RESOLVED
Last Resolved: 5 months ago
status-firefox53: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
I've updated the individual property pages:

https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/x
https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/y

I've also added a note to the Fx53 release notes:

https://developer.mozilla.org/en-US/Firefox/Releases/53#DOM_HTML_DOM
Keywords: dev-doc-needed → dev-doc-complete

Updated

9 days ago
Blocks: 1358051
You need to log in before you can comment on or make changes to this bug.