[css3-animations] CSSKeyframesRule.insertRule and rule ordering

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.

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/

Received on Friday, 1 April 2011 20:20:34 UTC