Open Bug 674292 Opened 8 years ago Updated Last year

Drop support for UIEvent.layerX and UIEvent.layerY


(Core :: DOM: Events, defect, P5)






(Reporter: jchaffraix, Unassigned)



(Keywords: dev-doc-needed)

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 ->

WebKit is considering removing those 2 properties as our code looks extremely old and we had zero bug about that.$&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?
Also, getting coordinates relative to the top-left corner of scrollable
element can be quite useful.
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?
Ever confirmed: true
Ever confirmed: false
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.
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.
Depends on: 69787
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.

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

keep the compatibility?
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  That page explicitly indicates it is for cross-browser compatibility.
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.

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.
Summary: Drop support for MouseEvent.layerX and MouseEvent.layerY → Drop support for UIEvent.layerX and UIEvent.layerY

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.