Bug 118045

Summary: Stylesheet rule.cssText for content property omits quotes
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WORKSFORME    
Severity: Normal CC: cdumez, clinton.ayres, dino, joepeck, karlcow, kling, koivisto, mihaip
Priority: P2 Keywords: BlinkMergeCandidate, BrowserCompat
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

Description Ryosuke Niwa 2013-06-26 00:06:48 PDT
Consider merging https://chromium.googlesource.com/chromium/blink/+/bcb65eaf9ef87cea28c6eb9a62890065a047e62c

PropertyContent's value should be quoted when the value is string.

Since PropertyContent's value is CSSValueList, added forceQuoteString parameter to customCssText of CSSValueList and CSSPrimitiveValue.
Comment 1 Joseph Pecoraro 2015-07-24 00:17:20 PDT
There are actually a number of recent Blink commits here that would improve our output of not just `content` but other properties that may output serialized strings:

https://chromium.googlesource.com/chromium/blink/+/98b9b9fdbecd8d860b2ca9c039adfc0491501c57 - allow some thigns to not be quoted
https://chromium.googlesource.com/chromium/blink/+/81caa9b01afbef1a41de355f9385a60da48ac556 - fix `content` processing from comma separated to space separated
https://chromium.googlesource.com/chromium/blink/+/3f2e47af2471ae3c3683079ffb5eb4b6f2e22df2 - fix `counter` strings.
https://chromium.googlesource.com/chromium/blink/+/c127d37233c824ba96d9fdba5bf4db8f1311fd0d - fix `content` strings.

This would be useful for the Web Inspector which wants to show "content" strings in the Computed Section of the inspector. Without similar changes, unquoted content computed values showing up in the Computed Section of the inspector are actually incorrect. See bug 147255.
Comment 2 Karl Dubost 2022-09-26 20:05:23 PDT
*** Bug 198536 has been marked as a duplicate of this bug. ***
Comment 3 Karl Dubost 2022-09-26 20:28:01 PDT
WIth 

data:text/html,<!doctype%20html><html><style></style></html>



document.querySelector('style').sheet.rules[0]
// undefined


document.querySelector('style').sheet.insertRule('.test { content: "moo"; }')
document.querySelector('style').sheet.rules[0].cssText
// ".test { content: \"moo\"; }"



Same results in Firefox, Chrome and Safari.