Re: [css-values] Relaxing <custom-ident> restrictions when unambiguous

On Thu, Mar 6, 2014 at 3:57 AM, Simon Sapin <simon.sapin@exyr.org> wrote:
> On 06/03/2014 04:29, fantasai wrote:
>>
>> On 03/04/2014 03:22 PM, Simon Sapin wrote:
>>>
>>> Hi,
>>>
>>> CSS Values and Units currently defines:
>>>
>>> http://dev.w3.org/csswg/css-values/#custom-idents
>>>>
>>>> Some properties accept arbitrary author-defined identifiers as a
>>>> component value. This generic data type is denoted by <custom-ident>,
>>>> and represents any valid CSS identifier that does not otherwise
>>>> appear as a pre-defined keyword in that property's value definition.
>>>> [...]
>>>>
>>>> The CSS-wide keywords are not valid <custom-ident>s. The ‘default’
>>>> keyword is reserved and is also not a valid <custom-ident>s.
>>>
>>>
>>> This is more restrictive than it needs to be.
>>
>>
>> OK, I've updated the spec:
>>     http://dev.w3.org/csswg/css-values-3/#custom-idents
>>
>> New text:
>>
>>     # Specifications using ‘<custom-ident>’ should specify clearly
>>     # what other keywords are excluded from <custom-ident>—
>>     # for example by saying that any pre-defined keywords
>>     # in that property's value definition are excluded.
>>     # As a general rule,an identifier that could be interpreted
>>     # as a pre-defined keyword in any position or multiplication
>>     # of the <custom-ident> component value is excluded,
>>     # and is invalid as a <custom-ident> matching to that component value
>>     # even in positions where its use would be technically unambiguous.
>>     # For example, if a keyword could be misparsed when specified
>>     # as the first item of a ‘<custom-ident>+’ list, it is invalid
>>     # when specified in any position in that list.
>>
>> Let me know if that seems good.

I'd prefer phrasing it as a default rule, which applies automatically
if the specification doesn't say anything else.  Right now it sounds
like a suggestion, or a description of how most instances would work,
and it still requires each use of <custom-ident> to specify that.

> The paragraph before the one you quoted is:
>
>> The CSS-wide keywords are not valid <custom-ident>s. The ‘default’
>> keyword is reserved and is also not a valid <custom-ident>.
>
>
> Do we want to exclude these even when they’re not ambiguous? For example,
> <custom-ident> in CSS Grid’s <line-names> is completely unambiguous thanks
> to the parens.

Agreed; they shouldn't be excluded when not at the top level. In other
words, we shouldn't need a special-case here - the fact that they're
valid keywords at the top-level will automatically exclude them from
being <custom-ident> values at the top-level, and the fact that
they're not valid at non-top levels means it's acceptable to allow
them at non-top levels.

> <'font-family'> is currently not defined with <custom-ident>. But if it
> were, it would be unambiguous when in the 'font' shorthand because of the
> mandatory <'font-size'> that separate it from other keywords.

Agreed; note also, though, the additional restriction made on
<'font-size'> that it is not allowed to be a single ident matching one
of the globals.  This just means that we need to ensure that the spec
allows others specs to define arbitrary additional conditions,
including relaxing the default restriction.

~TJ

Received on Thursday, 6 March 2014 17:38:11 UTC