Skip to content

[css-transforms-2] How to serialize scale if we only use one number? #313

@BorisChiou

Description

@BorisChiou

The spec [1] doesn't mention how to serialize the individual transforms. This may be fine but still not clear to me for the case:

div { 
  scale: 2;
}
console.log(window.getComputedStyle(div).scale); // serialize as "2" or "2 2"?

If only the X value is given, the Y value defaults to the same value, and If one or two values are given, this specifies a 2d scaling, equivalent to the scale() function (i.e. scale(2, 2) in the above example). However, should we serialize it as "2" or "2 2"? For now, Chrome serializes this as "2 2", but Firefox serializes this as "2", so I think this is an ambiguous part. Maybe the shorter one is preferred?

[1] https://drafts.csswg.org/css-transforms-2/#propdef-rotate

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions