Re: proposal for a new css combinator

James Elmore wrote:
> 
> On Jan 14, 2010, at 8:51 AM, Aryeh Gregor wrote:
> 
>> On Thu, Jan 14, 2010 at 10:58 AM, James Elmore <James.Elmore@cox.net> 
>> wrote:
>>> What about allowing multiple limits? A combinator could let the depth of
>>> control be stated, or limited by the designer.
>>>
>>> Just as an example, "h1 (1-2)h2" might select the first two levels of h2
>>> elements under an h1 element.
>>
>> Isn't this the same as h1 % h2, h1 % h2 % h2?
>>
>>> Even more, the (an+b) syntax might allow each nth child (or other
>>> combinator) to be selected, so, for example, alternate headings could be
>>> different colors.
>>
>> This might be useful.  For instance, one common requirement is to have
>> list bullets differ with nesting.  This would be nice to have like
>>
>> ul > li { list-style-type: disc }
>> ul > li ul > li { list-style-type: square }
>> ul > li ul > li ul > li { list-style-type: circle }
>>
>> Ideally you'd like to continue disc, square, circle, disc, square, 
>> circle, . . .
> 
> So, assuming the <ul>'s are all within some <div> (or otherwise 
> specified -- like with a .class), the style rules might look like this:
> 
> div (3n)ul   { list-style-type: disc; }
> div (3n+1)ul { list-style-type: square; }
> div (3n+2)ul { list-style-type: circle; }
> 
> That seems to be a powerful and useful syntax for combinators.
> 
> <James />


I agree but what happens if a wrapper between the <div> and the <ul> is 
insert by a script? This is the same as when an extra list item is 
inserted into a list. No set of sibling combinators will select the last 
child. Only this will work.

div li:last-child

This is why I see '+' and last-child as different. This is why I am (or 
was) seeing this as a structural pseudo-classes. As usual I have gone 
out of orbit and should be proposing a different selector. :-0


-- 
Alan http://css-class.com/

Received on Thursday, 14 January 2010 18:37:08 UTC