Re: [css3-animations] CSSKeyframesRule.insertRule and rule ordering

On 02/04/2011, at 7:20 AM, L. David Baron wrote:

> http://dev.w3.org/csswg/css3-animations/#DOM-CSSKeyframesRule
> describes an insertRule method that says the rule is insert
> according to its key.  That doesn't really explain where the rule
> goes in the list of rules (which are in the order given in the
> sheet, which need not match key order).  It seems like to give the
> result that the spec describes for insertRule, it should always
> append the rule -- and then the keys would override the keys of any
> previously-existing rules, since
> http://dev.w3.org/csswg/css3-animations/#keyframes says:
>  # To determine the set of keyframes, all of the values in
>  # selectors are sorted in increasing order by time. If there are
>  # any duplicates, then the last keyframe specified inside the
>  # @keyframes rule will be used to provide the keyframe information
>  # for that time.
> 
> Replacing a rule with exactly the same key seems confusing; it would
> mean you'd get the replacing behavior when appending "25%, 75%" when
> you already had a "25%, 75%", but the non-replacing behavior if you
> already had two identical rules.
> 
> I think the simplest thing is to just append the rule -- though that
> raises the question of why the method is called insertRule rather
> than appendRule.

I'm ok with renaming to appendRule. I'm not a big fan of this API anyway. It's slow and cumbersome, and I've found little use for it (but it is all we have at the moment).

Dean

Received on Saturday, 2 April 2011 00:49:46 UTC