Re: [selectors-4] selector matching being specified from left to right

On Tue, Aug 11, 2015 at 10:31 AM, fantasai
<fantasai.lists@inkedblade.net> wrote:
> On 03/23/2015 09:17 PM, L. David Baron wrote:
>>
>> http://dev.w3.org/csswg/selectors-4/#evaluating-selectors introduces
>> an algorithm that defines how selectors are matched.  It does so by
>> doing the matching from left to right (across combinators), which is
>> the opposite of what all implementations that I'm aware of do.
>>
>> Specifying it this way seems like a very bad idea, because it
>> introduces a number of risks:
>>
>>   (1) specification authors might introduce features that are easy to
>>   describe in the spec's left-to-right matching but hard to implement
>>   in the implementations' right-to-left matching
>>
>>   (2) we might want to introduce features that are simple in the
>>   implementations' right-to-left matching, but that are hard to
>>   describe it the spec's right-to-left matching
>>
>>   (3) we might introduce features where it's easy to make subtle
>>   errors in the mapping between the two descriptions; this can lead
>>   to things that are technically bugs in implementations, and might
>>   even do so interoperably.  It's better for these not to be bugs,
>>   and just to match the spec.
>>
>> So I think that if the spec introduces an algorithmic description of
>> selector matching (as the current draft of selectors-4 does), that
>> algorithm should work the same way implementations work.
>
>
> I don't understand why we are specifying an algorithm here at all.
> There is nothing to be gained from the spec providing an algorithm
> as opposed to a description of the required output.
>
> Tab, why is this section in the spec? What is it providing that's
> not otherwise provided?

It provides a basis for me to actually define combinators in a
rigorous way, which is necessary when we have more complex combinators
like the shadow-piercing ones (tho we're changing them).  When you're
crossing between contexts and have to define in what context each part
of the selector is actually evaluated in, having a good description of
the process makes it much easier and less error-prone.

~TJ

Received on Tuesday, 11 August 2015 17:40:29 UTC