W3C home > Mailing lists > Public > www-style@w3.org > February 2014

Re: [css-counter-styles] About override loop

From: Xidorn Quan <quanxunzhen@gmail.com>
Date: Sat, 22 Feb 2014 09:26:47 +1100
Message-ID: <CAMdq698M-J1qeu_x75HAeZmsekr35HLw=WatrJ1Bt-Fn8VAorw@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: www-style list <www-style@w3.org>
On Sat, Feb 22, 2014 at 8:33 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> On Fri, Feb 21, 2014 at 1:13 PM, Xidorn Quan <quanxunzhen@gmail.com> wrote:
>> On Saturday, February 22, 2014, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>>> On Mon, Feb 17, 2014 at 4:12 AM, Xidorn Quan <quanxunzhen@gmail.com>
>>> wrote:
>>> > On Mon, Feb 17, 2014 at 8:23 PM, Xidorn Quan <quanxunzhen@gmail.com>
>>> > wrote:
>>> >> The current draft doesn't discuss what will happen if there is an
>>> >> override loop. However, it is obvious that all styles in an override
>>> >> loop should actually override 'decimal', like those override a
>>> >> nonexistent style. I just think it is better to mention such case in
>>> >> the spec.
>>> >
>>> > After doing some thinking, I propose that only the descriptor which is
>>> > unspecified in all styles in the cycle should fall to 'decimal'.
>>> >
>>> > For example, if there is three styles: A, B, and C:
>>> >
>>> > @counter-style A { system: override B; negative: A; }
>>> > @counter-style B { system: override C; prefix: B; }
>>> > @counter-style C { system: override A; suffix: C; }
>>> >
>>> > Then all three styles should use 'A' for 'negative', 'B' for 'prefix',
>>> > and 'C' for 'suffix', and other descriptors will inherent the value of
>>> > 'decimal'.
>>>
>>> Hm, I think that's more trouble than it's worth.  The cycle is an
>>> error in the first place; we *could* try to patch things up and do a
>>> minimal amount of failure, but I'd rather just make the entire thing
>>> fail in a more obvious fashion.
>>
>> As it is an error, would you mind leave it for implementations to decide how
>> to deal with it?
>
> No, errors have to be specified just as precisely as correct behavior.
>
> Is it easier to handle it in the way you suggest?  I would think it's
> easier to just detect a cycle and then adjust the internal 'system'
> value of all of the offending counter styles to override decimal
> instead.  Then there's no special behavior.

Yes, I think it is easier to implement in the way I suggested. For
that way, recursive call can still be used with some tricks, like
temporarily specifying the overridden style to decimal, to avoid
infinite loop. But if all styles in loop has to be treated as
overriding decimal, it is necessary to add an explicit loop detection,
and a specific procedure for styles in cycle.

In addition, I think doing a minimal failure is more intuitive, isn't it?

- Xidorn
Received on Friday, 21 February 2014 22:27:59 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:19 UTC