Re: proposal for a new css combinator

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 />

Received on Thursday, 14 January 2010 18:10:33 UTC