Re: [css-counter-styles] Behavior of setting attributes

On Sat, Feb 8, 2014 at 12:43 AM, Simon Sapin <simon.sapin@exyr.org> wrote:
> On 07/02/2014 13:20, Xidorn Quan wrote:
>>
>> Hi,
>>
>> I have a question about the behavior of the DOM API:
>>
>> If a string which is valid in grammar while invalid in other aspect is
>> set to an attribute in CSSCounterStyleRule, what should happen? For
>> example, when the system is numeric, but a string contains only one
>> symbol is set to symbols, or the additive-symbols attribute is set to
>> a non-descending list. Should such strings be accepted or rejected?
>
> I think they should be rejected. The setter should accept or reject the same
> values as the declaration would in a stylesheet. Maybe "grammar" is not the
> right term to use in this bit of spec, but I don’t have a better suggestion.

But rejecting them could bring a more complex dilemma: when the
"symbols" contains only one because the system is, for example,
symbolic, and then "system" is changed to something like numeric, what
should happen? Should we also reject the change to attribute "system"?

There is an important difference between setter and declaration:
declaration is a bulk which can be accepted or rejected as a whole
while setter is not. Individually accepting or rejecting a value could
make user more confused.

I suggest to mark the attribute "system" readonly so that we have an
invariant for the rule which enables us to check changes to other
attributes. Besides, I think "name" should be readonly as well.

In addition, I propose that, "additive-symbols" with non-descending
order weight makes the descriptor itself invalid instead of the whole
rule. The reason is that someone may add "additive-symbols" descriptor
in a rule with "system" other than additive (which though is useless,
but is acceptable according to the spec), and the whole rule should
not be invalidated because of an useless descriptor.

Regards,
Xidorn Quan

Received on Friday, 7 February 2014 22:58:59 UTC