Re: [css-syntax] An+B nits

On Sat, Feb 22, 2014 at 10:49 AM, Brad Kemper <brad.kemper@gmail.com> wrote:
>> On Feb 22, 2014, at 8:49 AM, Simon Sapin <simon.sapin@exyr.org> wrote:
>>> On 22/02/2014 16:39, Brad Kemper wrote:
>>> In the An+B micro syntax section [1], I noted the following issues:
>>>
>>> • Example 35 uses '-n', but only later is it explained that an 'n'
>>> without a number before it is the same as 1n (thus '-n' means the same
>>> as '-1n'). For example 35, it would be more clear at that point if it
>>> was written as '-1n+6'. It would also be helpful IMO if there was also
>>> an example there using a negative n that resulted in a list of more than
>>> one item, such as:
>>>
>>> –4n+10   /* represents the 6th and 2nd elements in the list */
>>>
>>> By the way, would that be the right order of the results in the CSSOM,
>>> or do they get sorted?
>>>
>>> • the spec says that a negative 'n' is allowed, but it does not make it
>>> clear how to write that. The text above examples 38 and 39 imply that
>>> the minus sign can just replace the plus sign, but I think there should
>>> be prose to that effect, such as in the opening paragraph of the syntax
>>> section. Is it valid to also add a negative, as in '5n + -1'? I think
>>> the grammar section says no, but I am not sure.
>>>
>>> 1) http://dev.w3.org/csswg/selectors4/#anb
>>
>>
>> I believe the plan is to remove that section and reference CSS Syntax instead: http://dev.w3.org/csswg/css-syntax/#anb
>
> OK, changing the subject line, and noting that there is even less detail about this micro syntax there, where it also surfers from the same problems.

http://dev.w3.org/csswg/css-syntax/#anb-syntax

The test preceding example 6 explains how the number can be omitted if
it's 1 or -1.  Example 6 itself doesn't show a -n syntax example, but
Example 8 does.

>> Pseudo-classes can be though of as boolean tests.
>
> Right. I should have thought of that.
>
>> The sign of A in :nth-child(An+B) does not affect the order of Selector API results. (By the way, is that order specified at all?)
>
> Good question.

Yes: http://www.w3.org/TR/selectors-api2/#findelements "must return a
NodeList containing all of the matching Element nodes ... in tree
order".

~TJ

Received on Monday, 24 February 2014 20:54:46 UTC