[svgwg] Serialization of transform functions and transform attribute. (#932)

karlcow has just created a new issue for https://github.com/w3c/svgwg:

== Serialization of transform functions and transform attribute. ==
I'm in the process of creating some WPT tests for transform functions such as `setScale(sx, sy)` and `setTranslate(tx, ty)` because browsers send different results. 

I want also to make sure that I get [my analysis of serialization](https://github.com/WebKit/WebKit/pull/23492#issuecomment-1921346525) correct with regards to the attribute values.

# Missing comma in Safari and Chrome

```
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
var g = document.createElementNS('http://www.w3.org/2000/svg', 'g');
var transform = svg.createSVGTransform();
transform.setScale(-2, -4);
g.transform.baseVal.appendItem(transform)
g.getAttribute('transform')
```

And the results are:
```
         IN             OUT
Safari:  scale(-2, -4)  scale(-2 -4)
Firefox: scale(-2, -4)  scale(-2, -4)
Chrome:  scale(-2, -4)  scale(-2 -4)
```

# Modifying an existing transform attribute missing comma

```
data:text/html,<svg><g><circle r="100" transform="scale(2)"/></svg></g>
```

Then

```
const circle = document.querySelector("circle");
circle.getAttribute('transform');
// "scale(2)" everywhere
circle.transform.baseVal.getItem(0).setScale(3, 4)
circle.getAttribute('transform');
// "scale(3, 4)" in Firefox, "scale(3 4)" in Safari and Chrome
```




Please view or discuss this issue at https://github.com/w3c/svgwg/issues/932 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 2 February 2024 05:25:25 UTC