CSS @font-face src string allows invalid items #18454
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The CSS
@font-face
at rule takes as asrc
a comma separate list of possible font descriptors. As per the spec here the parser is supposed to treat each item in thesrc
separately, adding those that are valid and dropping those that are invalid or not supported. However a number of browser will drop the wholesrc
string if any item is not understood.tech()
they will drop an item that usestech()
and not the whole string. However if you use another value likefred()
they will drop the whole line. In other words, not a future proof implementation as new values are added, but works for the currently supported set.My test code is to run this in a console:
If the
src
is present in "thingy" then the string is parsed properly. This fails for chrome, but if you changefred
totech
above you can see it works for that single (most important) case.This comes out of discussion in w3c/csswg-drafts#7753 (comment)
FYI @queengooborg