Skip to content

[css-typed-om] Serialization of 2D CSSScale should never skip the second value #1161

Open

Description

@gmta

Regarding the serialization of CSSScale, the second value should always be serialized, even if its value is equal to the first.

Test case:

<!DOCTYPE html>
<style>
#a {
    transform: scale(1.5);
}
</style>
<div id="a"></div>
<script>
console.log(a.computedStyleMap().get("transform").toString());
</script>

Both Chrome and Safari output scale(1.5, 1.5) as the serialized value.

Activity

  1. emilio commented on Nov 19, 2025

    @emilio
    Contributor

    That seems wrong tho?

    scale(1.5) is the shortest serialization. Chrome and WebKit also serialize with one argument if you serialize specified styles:

    document.body.style.transform = "scale(1.5)"; console.log(document.body.style.transform);
    

    Though I don't think they omit the second argument if equal to the first (they should tho, and Firefox does it):

    document.body.style.transform = "scale(1.5, 1.5)"; console.log(document.body.style.transform);
    
  2. gmta commented on Nov 19, 2025

    @gmta
    Author

    @emilio It looks like Firefox is the only one doing so. I've expanded on my test case a bit:

    Revised test case
    <!DOCTYPE html>
    <style>
    #a {
        transform: scale(1.5);
    }
    #b {
        transform: scale(1.5, 1.5);
    }
    </style>
    <div id="a"></div>
    <div id="b"></div>
    <script>
    try {
        console.log('computedStyleMap, one value:', a.computedStyleMap().get("transform").toString());
        console.log('computedStyleMap, two values:', b.computedStyleMap().get("transform").toString());
    } catch (e) {
        console.log('computedStyleMap() unavailable');
    }
    
    const divElm = document.createElement('div');
    divElm.style.transform = 'scale(1.5)';
    console.log('style, one value:', divElm.style.transform);
    
    divElm.style.transform = 'scale(1.5, 1.5)';
    console.log('style, two values:', divElm.style.transform);
    </script>
    Firefox
    144.0.2
    Chrome
    142.0.7444.176
    Safari
    18.6
    Ladybird
    8348c55570d
    computedStyleMap, 1 value N/A scale(1.5, 1.5) scale(1.5, 1.5) scale(1.5, 1.5)
    computedStyleMap, 2 values N/A scale(1.5, 1.5) scale(1.5, 1.5) scale(1.5, 1.5)
    style, 1 value scale(1.5) scale(1.5) scale(1.5) scale(1.5)
    style, 2 values scale(1.5) scale(1.5, 1.5) scale(1.5, 1.5) scale(1.5, 1.5)

    The reason I'm reporting this is since I saw Chrome and Safari behaving the same, and the css/css-transforms/animation/transform-interpolation-computed-value.html WPT test also expects two values, not one.

    If you're convinced this is an issue with Chrome and Safari, I could also send in a PR to WPT?

  3. emilio commented on Nov 19, 2025

    @emilio
    Contributor

    I think in principle this is a Chrome / WebKit bug. cc @janvarga

  4. deleted a comment from on Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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