Re: [csswg-drafts] [css-om] Serialization of font-family names: quoted string vs keyword (#5846)

Blink basically does not add quote to a `<family-name>` iff it can be parsed as a CSS <ident> minus backslash-escape sequences:

https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/css/css_markup.cc;l=145;drc=0a7ae0e6c7f507bf4d102df97e733628566b4736

There is a bug though : `"serif"` (with quotes i.e. `<font-family>`) becomes `serif` (without quotes i.e. `<generic-family>`) when serialized. See the two second case of 

https://w3c-test.org/css/cssom/font-family-serialization-001.html

But it's easy to fix by always adding quotes if the name is the same as a `<generic-family>`.

I think the spec should clearly specify how to serialize `font-family` if it is different from a comma-separated list of identifiers/strings.

-- 
GitHub Notification of comment by fred-wang
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5846#issuecomment-897474104 using your GitHub account


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

Received on Thursday, 12 August 2021 09:08:35 UTC