W3C home > Mailing lists > Public > www-style@w3.org > June 2010

Re: [css3-selectors] The :nth-sibling combinator

From: Brad Kemper <brad.kemper@gmail.com>
Date: Mon, 21 Jun 2010 10:29:31 -0700
Message-Id: <8825B7B5-B64F-4875-A979-6D400B124EEF@gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Eduard Pascual <herenvardo@gmail.com>, Gabriele Romanato <gabriele.romanato@gmail.com>, "www-style@w3.org" <www-style@w3.org>


On Jun 21, 2010, at 10:04 AM, "Tab Atkins Jr." <jackalmage@gmail.com>  
wrote:

>> However, what would happen if you had something like this?
>> <div>
>>   <span>...</span>
>>   <img ... alt="Now things are getting funnier!">
>>   <span>...</span>
>> </div>
>> Then we get a difference between what the selectors would match:
>> div>span+span+span matches nothing, while div>span:nth-child(3)
>> matches the <span> after the <img>.
>
> The actual equivalent of "span:nth-sibling(3)" is "* + * + span".
> Both of these would match the same things in both examples, and in
> your example below.

It seems the intent is not clear. I thought 'span:nth-sibling(3)' was  
supposed to match only the third of that type, when sequential. Like  
this:

span:first-of-type + span + span

  
Received on Monday, 21 June 2010 17:30:18 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:28 GMT