jQuery event.layerX/Y is not relative to the element that triggered the event, is that correct?
- by michielvoo
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?