Re: [css3-values] use cases and the design of 'cycle()'

On Mon, Apr 9, 2012 at 2:58 PM, Joshua Cranmer <Pidgeot18@verizon.net> wrote:
> On 4/9/2012 3:44 PM, Tab Atkins Jr. wrote:
>
>> The only way I can think of doing what you want is to force cycle() to
>> take an ident, and have it compute to the ith entry, where i = (number
>> of ancestors with a cycle using the same ident) mod (number of entries
>> in this cycle).  This doesn't require any tricky comparison at all
>> unless we want to add some for aesthetic purposes - cycle()s with the
>> same ident can have different values in each entry, and even different
>> numbers of entries.
>
> One problem with this design is as follows. If I have a style like so:
> ul.crazycool { list-style-type: cycle(coola, coolb, coolc); }
>
> Then the fragment "<ul><ul class=crazycool>" would cause the latter to be
> styled with coolb instead of coola, which is probably not the result the
> user desired. Nor is there a way to force the intended result that is
> independent of the hierarchy of the element, so any change even to the UA
> stylesheet could wreck a user's stylesheet which is intended to override
> everything else.

I don't understand; it's possible you may have misunderstood what I
tried to say, or I'm misunderstanding your code.

In the idea I outline above, cycle() takes an ident as its first
argument, then a list of values to cycle between.

So you'd write it something like:

ul.crazycool { list-style-type: cycle(cool-list, coola, coolb, coolc); }

Then, if you nest the markup like "<ul><ul class=crazycool>", the
parent <ul> presumably isn't using a cycle() identified with
"cool-list", so the child <ul> will just grab its first value,
'coola'.

If you then have another <ul class=crazycool> nested at any depth
inside of that, it'll use 'coolb', regardless of what comes between
them (unless there's another cycle() identified with "cool-list").

~TJ

Received on Monday, 9 April 2012 22:19:16 UTC