Re: [selectors] Improving the definition of language range in :lang()

On 12/11/14 11:06 AM, Tab Atkins Jr. wrote:
> On Wed, Dec 10, 2014 at 11:14 PM, L. David Baron <dbaron@dbaron.org> wrote:
>> On Wednesday 2014-12-10 09:28 -0800, fantasai wrote:
>>> On 12/10/2014 08:41 AM, Tab Atkins Jr. wrote:
>>>> As it stands, you can still write *-1996 in :lang() by escaping the
>>>> dash, like `:lang(*\-1996)` - that turns it into an asterisk followed
>>>> by an identifier.  This, of course, isn't great.  I think we assumed
>>>> that language tags weren't ever composed of just numbers.  We should
>>>> probably allow a string in :lang() as well, for when tokenization
>>>> doesn't work well for the given language tag.
>>>
>>> To the extent that we allow escaped asterisks here, you can also
>>> handle this issue via :lang(\*-1996), since that will also parse
>>> as an identifier.
>>
>> I believe one of the things discussed in today's teleconference, and
>> one that I support, was to add to the syntax for :lang() by allowing
>> a string to be the argument, so that :lang("*-1996") can be used.
>>
>> (It's then worth considering exactly which non-identifier cases
>> should be allowed, and which should require escaping or being
>> written as strings.)
>
> Yeah, I recommend, for simplicity, only allowing identifiers and
> strings.  This means that, ignoring escaping for a moment, everything
> valid in Selectors 3 is still valid, but the new stuff requires no
> thinking about parsing.
>
> People can still use escapes to get an ident with asterisks in it, and
> that would work just fine, it's just unlikely to be done.

I like the idea of only allowing identifiers and strings.

The exception for the first asterisk ended up being confusing in practice.

Benjamin

Received on Thursday, 11 December 2014 23:05:45 UTC