You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See https://drafts.csswg.org/cssom-view/#dom-mouseevent-offsetx
According to the spec, offsetX/offsetY of the MouseEvent should correspond to the target element's padding edge.
However, only Gecko conforms to that when it comes to inline elements.
This makes it so that getting the offsetX for e.g. a elements requires an additional computation, and only on certain browsers, and basically makes offsetX/Y unusable for inline elements.
Currently the only way to compute offsetX/Y in a cross-browser way is to use potentially costly measurements such as getClientRects and subtracting them from the event's clientX/clientY.
Some websites do this to avoid the cross-browser complexities.
I suggest one of the following:
Fix the issue in Blink/WebKit to match the spec (I am in favor in this, but not too familiar with the web-compat implication)
Change the spec and Fix Gecko, maybe create an alternate API to retrieve the offsetX/Y for an inline-element