Skip to content

[cssom-view] Element (or Node) should contain the properties offset... (offsetParent, offsetLeft, ...) #10514

Open
@jogibear9988

Description

@jogibear9988

Problem

I'm writing a Designer Application, where I show overlays for all Elements (like the Dev Tools). For this to work, I need to calculate the the corners of the rect of an Element. This works using getBoundingClientRect, but only if the Element is not transformed. If the Element for example is rotated, this will not return the points of the element, but the outer rect. And also a element could be inside of another transformed element (and so on).
I know calculate the combined transformation of the element, but for this I need the position of the element inside of it's container. This works on HTMLElements (cause they have offsetLeft and offsetTop), but not on SVG or MathML Elements.

As also MathML and SVG Elements could be aligned inside of HTMLElements, they should also contain these Properties. And also, as they also could be positioned absolutely, they should contain the "offsetParent", to get to wich they are positioned to.

Additional, as also a TextNode could be positioned inside of a container, I think it should also get the "offset..." Properties. So maybe it should be added to the "Node" Interface instead of the "Element" interface.

The spec is here:
https://www.w3.org/TR/cssom-view-1/#extensions-to-the-htmlelement-interface
I think it should be changed to "Element" instead of "HTMLElement"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions