[csswg-drafts] [css-fonts] Empty quoted font family name should not parse as valid (#4510)

drott has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-fonts] Empty quoted font family name should not parse as valid ==
In a recent Chrome issue we discovered that a style definition such as:
`font: 1px "";`
would parse as valid according to the spec prose.

Similarly, a JS font loading call such as:
`document.fonts.load("1px \"\"")`
leads to a promise with status `resolved` / `fulfilled` in Safari / Firefox, even though to me that does not make sense, as a font with an empty family name cannot be reasonably matched.

I suggest to add normative text in [section 3.1](https://drafts.csswg.org/css-fonts/#font-family-prop) below the following paragraph:

> Font family names other than generic families must either be given quoted as strings, or unquoted as a sequence of one or more identifiers. This means most punctuation characters and digits at the start of each token must be escaped in unquoted font family names.

similar to

> The empty quoted string: "" is an invalid font family name.

Then we can add to the examples:

```
font-family: "", sans-serif;
font-family: "";
```

Perhaps we need to add something as well to describe that:
`font-family: ,,,;`
also should not parse as valid, i.e. a sequence of null identifiers separated by commas.


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4510 using your GitHub account

Received on Thursday, 14 November 2019 10:03:29 UTC