jQuery event.layerX/Y is not relative to the element that triggered the event, is that correct?

Posted by michielvoo on Stack Overflow See other posts from Stack Overflow or by michielvoo
Published on 2010-06-17T11:42:41Z Indexed on 2010/06/17 11:53 UTC
Read the original article Hit count: 294

Filed under:
|
|

If I use for example a mousemove event handler on a div and check the layerX property of the event, it changes when my mouse enters a positioned element inside that div (like an image).

According to the jQuery Event object documentation it should follow the W3C DOM Level 3 specifications. But there's no mention of the layerX/Y property for the MouseEvent interface, so I'm wondering what behavior is according to specification?

To me it seems that you always want the layerX/Y to be relative to the layer that fires the event, if I wanted the layerX/Y of a nested element, I would check the event in a different phase (bubbling) or would attach my handler to that nested element.

My question is (somewhat subjective): how should layerX/Y work?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about events