Bug 253041

Summary: CSSStyleRule.selectorText contains unquoted colon
Product: WebKit Reporter: vojacem
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: annevk, koivisto, mmaxfield, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 16   
Hardware: Unspecified   
OS: Unspecified   

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 ***