Open
Description
From https://bugs.webkit.org/show_bug.cgi?id=268742:
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:
h6 { background: url(\/my-image\.png), var(--my-image); }
Chrome and Firefox outputs:
h6 { background: url(/my-image.png), var(--my-image); }
Per spec, cssText
returns "a serialization of the CSS rule".
A URL is serialized as '"url(", followed by the serialization of the URL as a string, followed by ")"', which implies the above should be url("/my-image.png")
, contrary to all major browsers.