[csswg-drafts] [cssom-view] MouseEvent.offsetX/offsetY not defined for SVG layout elements

AmeliaBR has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom-view] MouseEvent.offsetX/offsetY not defined for SVG layout elements ==
The definition of [`MouseEvent.offsetX`/`Y`](https://drafts.csswg.org/cssom-view/#dom-mouseevent-offsetx) is:

> The offsetX[Y] attribute must follow these steps:
>
> 1. If the event’s dispatch flag is set, return the x[y]-coordinate of the position where the event occurred relative to the origin of the padding edge of the target node, ignoring the transforms that apply to the element and its ancestors, and terminate these steps.
> 2. Return the value of the event’s pageX[Y] attribute.

Which doesn't give any guidance for what to do when the event target is an SVG layout element, and doesn't have its own padding edge.  Firefox seems to use the bounding box of the SVG element (and the local user-space coordinate system).  Other browsers seem to use the padding-box of the nearest ancestor `<svg>` with CSS box layout, and the outside coordinate system for that element (i.e., not including any `viewBox` scaling).  (Firefox does the same when the event target is an `<svg>` element that has CSS layout boxes.)

For what it's worth: the Firefox behavior is much more useful when working with SVG.  But it seems that the cowpath is more heavily-trodden in the other direction.

More generally: reading that definition, I have no idea how "ignoring the transforms" is supposed to be interpreted. Use the local coordinate system or use the document coordinate system?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1508 using your GitHub account

Received on Thursday, 8 June 2017 03:38:12 UTC