Bug 253041 - CSSStyleRule.selectorText contains unquoted colon
Summary: CSSStyleRule.selectorText contains unquoted colon
Status: RESOLVED DUPLICATE of bug 184604
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: Safari 16
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-02-27 16:36 PST by vojacem
Modified: 2023-08-26 00:15 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vojacem 2023-02-27 16:36:10 PST
CSSStyleRule.selectorText contains unquoted colons. Recreating rules with colons leads to broken syntax.

Steps to reproduce:
# Open `about:blank`
# Run the following piece of code, the red box is not shown in Safari.

const styleElement = document.createElement('style')
styleElement.innerHTML = `
[a\\:b], .red {
  background-color: red;
  width: 100px;
  height: 100px;
}
`
const divElement = document.createElement('div')
divElement.className = 'red'
document.body.append(styleElement, divElement)

console.log(styleElement.sheet.cssRules[0].selectorText + " should be [a\\:b], .red")
styleElement.innerHTML = styleElement.sheet.cssRules[0].cssText
Comment 1 Radar WebKit Bug Importer 2023-03-06 16:37:16 PST
<rdar://problem/106330426>
Comment 2 Anne van Kesteren 2023-08-26 00:15:58 PDT
Thanks for taking the time to report this; I recently fixed this.

*** This bug has been marked as a duplicate of bug 184604 ***