Note: There are a few cases of duplicates in user autocompletion which are being worked on.

Drop support for UIEvent.layerX and UIEvent.layerY

UNCONFIRMED
Unassigned

Status

()

Core
DOM: Events
UNCONFIRMED
6 years ago
2 years ago

People

(Reporter: Julien Chaffraix, Unassigned)

Tracking

({dev-doc-needed})

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
Per discussion on #content, this is a request to drop support for MouseEvent's layerX and layerY. It is currently supported only by Gecko and WebKit (context for WebKit -> https://bugs.webkit.org/show_bug.cgi?id=21868).

WebKit is considering removing those 2 properties as our code looks extremely old and we had zero bug about that.

Comment 1

6 years ago
http://www.google.com/codesearch#search/&q=layerX%20lang:%5Ejavascript$&p=4&sq=&type=cs
gives quite a few results.

But still layerX/Y aren't probably used too often, alhtough they can be useful
when handling positioned elements.

Jonas, Boris, Roc, any comments?

Comment 2

6 years ago
Also, getting coordinates relative to the top-left corner of scrollable
element can be quite useful.

Comment 3

6 years ago
Simon, you suggested dropping layerX/Y. 
May I ask why? Just because they are rarely used, or do you see
something badly wrong with them?
Status: UNCONFIRMED → NEW
Ever confirmed: true

Updated

6 years ago
Status: NEW → UNCONFIRMED
Ever confirmed: false

Comment 4

6 years ago
They are not specified anywhere, the 'layer' name seems to be a holdover from Netscape 4 "layers", and WebKit's implementation was very probably wrong.
I think we should try removing them.
I agree, we should try to remove this. We absolutely do need an API for dealing with coordinates when there are scrollable and transformed regions involved, but layerX and layerY are unlikely to cut it. I'd be much more interested to see a function which let you pass in an element and returned the event's coordinates in that element's coordinate space.

Maybe a good approach here is to add warnings on trunk right now, and remove the functions completely in a couple of weeks when we've branched for FF8.
(Reporter)

Comment 7

6 years ago
FYI, as of today, WebKit has deprecated layerX / layerY (we show a warning in the console when they are used). Due to them being exposed in one native API, they will survive until removed from there.
We should add support for offsetX/offsetY which is defined in CSSOM View before dropping layerX/layerY.
http://www.w3.org/TR/cssom-view/#dom-mouseevent-offsetx
Depends on: 69787

Comment 9

6 years ago
offsetX/Y is a different beast. What have they to do with layerX/Y?
layerX/Y is often used to compensate a lacking support for offsetX/offsetY.

Comment 11

6 years ago
http://msdn.microsoft.com/en-us/library/ms530302%28VS.85%29.aspx

IE now uses layerX layerY for calculating offset to parent's border, not affected by transform.

keep the compatibility?

Comment 12

5 years ago
There is no valid justification for removing layerX/Y.

layerX/Y are supported in Firefox, Chrome & IE. They work exactly as expected and as documented. 

Why would you remove useful perfectly working cross-browser compatible functionality with no equivalent functionality to replace it?

I use layerX/Y extensively and have done so for many years, I'm sure that I can't be the only person who will be caused massive problems by the removal of these properties.
layerX/Y work in IE?  That's not what comment 0 says ...
Comment 11 suggests that IE does (recent versions only?) and so do pages like http://msdn.microsoft.com/en-us/library/gg130967%28v=vs.85%29.aspx  That page explicitly indicates it is for cross-browser compatibility.

Comment 15

5 years ago
I don't know which version of IE supports the properties as layerX/Y (IE8 does not) but they are just an alias for the x/y properties which have been in IE for years and have the same functionality as layerX/Y.

see
http://msdn.microsoft.com/en-us/library/ff974658(v=vs.85).aspx

Comment 16

3 years ago
FWIW Firefox's layerX/Y differs in implementation from Chrome, Safari, and IE now, with regard to some transformed elements.  I haven't done extensive testing but on an element that has the following example transform:

-moz-transform: matrix3d(2.20842572062084, 0, 0, 0.00241685144124169, 0, 2.11751662971175, 0, 0.00372505543237251, 0, 0, 1, 0, 0, 0, 0, 1);
-moz-transform-origin: 0px 0px 0px;

Chrome, Safari, and IE report layerX/Y values for the element's original bounding box and FF reports layerX/Y more inline with what the offetX/Y would be (if FF implemented those) - which is to say where the location is as if it had happened on the untransformed element.

Updated

2 years ago
Summary: Drop support for MouseEvent.layerX and MouseEvent.layerY → Drop support for UIEvent.layerX and UIEvent.layerY
Keywords: dev-doc-needed
You need to log in before you can comment on or make changes to this bug.