Re: [csswg-drafts] [css-font-loading] Lack of interop on FontFace constructor. (#6236)

Regarding the rule for parsing family names in FontFace(), do we have the relevant specification document? I believe it's based on https://drafts.csswg.org/css-fonts/#family-name-syntax, correct? 

> It'd need to be "'@;! /* foo */'" or similar to be a valid (though weird) font-family name.

I have a related question—how is the family name stringified? Specifically, are single and double quotes treated differently? Should they be retained? I've observed that Gecko, Blink, and WebKit each handle the following example differently.

```
const fontface1 = new FontFace("'123'", 'url()');
console.log('1. fontface.family:', fontface1.family);

const fontface2 = new FontFace('"123"', 'url()');
console.log('2. fontface.family:', fontface2.family);

const fontface3 = new FontFace('123', 'url()');
console.log('3. fontface.family:', fontface3.family);

const fontface4 = new FontFace("123", 'url()');
console.log('4. fontface.family:', fontface4.family);
```
My original thought was simply `123` returned without quotes, but the results vary.

Blink output: the outer quotes peel off, but the inner quotes are retained as they are.
```
1. fontface.family: '123'
2. fontface.family: "123"
3. fontface.family: 123
4. fontface.family: 123
```

Gecko output: The inner single quotes are replaced with double quotes. Although the original font name is `123`, but `"123"` (a quoted name) is returned.
```
1. fontface.family: "123"
2. fontface.family: "123"
3. fontface.family: <empty string>
4. fontface.family: <empty string>
```

WebKit output: The outer quotes peel off. But, the name seems to be (double) quoted again when it is stringified. 
```
1. fontface.family:"'123'"
2. fontface.family:"\"123\""
3. fontface.family:"123"
4. fontface.family:"123"
```


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


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

Received on Friday, 1 August 2025 00:13:05 UTC