-
Notifications
You must be signed in to change notification settings - Fork 757
Description
In #11315, I touched on bad tokens in declaration values defined with forgiving grammars. Browsers handle them differently.
Bad tokens are <bad-string-token>, <bad-url-token>, and orphan ), ], }. Per a non-normative note in CSS Syntax, they are always parse errors but are preserved in the token stream to define fine-grained error-handling in some places like the prelude of @media.
Indeed, some rule preludes are defined with forgiving grammars.
At the top level, @media } {} is interpreted as @media not all {}. Nested, it is invalid and ignored: style { @media } {}. Is this difference a problem?
Browsers also interpret :is(}) {} differently. But note that the value of all functional pseudos is defined with <any-value>, which does not accept bad tokens, therefore :is(}) {} should be an invalid style rule, per spec.
I do not see the usefulness of allowing bad tokens in forgiving grammars. Would it be a problem to make consider them invalid in forgiving grammars?