[csswg-drafts] [cssom-1] Serializing via cssText doesn't give url(<string>) (#9913)

gsnedders has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom-1] Serializing via cssText doesn't give url(<string>) ==
From https://bugs.webkit.org/show_bug.cgi?id=268742:

```js
const style = document.createElement('style')
document.body.append(style)
style.sheet.insertRule(`h6 {
    background: url(/my-image.png), var(--my-image);
}`)
console.log(style.sheet.cssRules[0].cssText)
```

Safari outputs:
```css
h6 { background: url(\/my-image\.png), var(--my-image); }
```

Chrome and Firefox outputs:
```css
h6 { background: url(/my-image.png), var(--my-image); }
```

Per spec, `cssText` returns ["a serialization of the CSS rule"](https://drafts.csswg.org/cssom/#dom-cssrule-csstext).

A URL is serialized as ['"url(", followed by the serialization of the URL as a string, followed by ")"'](https://drafts.csswg.org/cssom/#serialize-a-url), which implies the above should be `url("/my-image.png")`, contrary to all major browsers.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9913 using your GitHub account


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

Received on Monday, 5 February 2024 19:01:03 UTC