Skip to content

[cssom]getComputedStyle(element) should return a list of transform functions #891

@gibbok

Description

@gibbok

I would like to suggest having getComputedStyle(element).transform function returning the actual transform functions and serialized matrix instead serialized matrix only.

Or alternative having a new function returning the actual transform functions.

Example:
https://jsfiddle.net/gibbok/pruyh2ns/

<div id="target"></div>
div {
  transform: translate(0, 0) rotate(45deg);
  width: 50px;
  height:100px;
  background-color:red;
}
var elem1 = document.getElementById("target");
var style = window.getComputedStyle(elem1, null);
console.log(style.transform);
// now returns matrix(0.707107, 0.707107, -0.707107, 0.707107, 0, 0)
// would be interesting having also the actual transform functions returned as translate(0, 0) rotate(45deg)

Related documentation:
https://drafts.csswg.org/css-transforms/#serialization-of-the-computed-value

Related:
https://bugs.chromium.org/p/chromium/issues/detail?id=680111
web-animations/web-animations-js#101

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