Closed Bug 841896 Opened 9 years ago Closed 9 years ago
Rule should have a `append Rule` method, not `insert Rule`
This was a spec change based on my feedback: https://dvcs.w3.org/hg/csswg/rev/08c0c83446dd . I need to go back and go through all the spec changes at some point.
So you mean that Firefox is out-of-date with the spec? It looks like the spec change you mention changes "insertRule" to "appendRule". Opera seems to be the only browser that uses "appendRule", but unfortunately seems to replace the whole keyframe instead of just appending to it.
I was thinking about appendChild method and insertBefore and I think this would be more consistent: // insert and merge styles (same as for += cssText, meaning "color:#333;left:10%" + "color:#999" effectively becomes "color:#999;left:10%") insertIntoRule(in DOMString keyText, in DOMString cssText); insertIntoRule(in DOMString keyText, in CSSStyleDeclaration style); // inserting rules at specific key; replacing upon duplicate key setRule(in DOMString keyText, in DOMString cssText); setRule(in DOMString keyText, in CSSStyleDeclaration style); I think neither insertBefore nore appendRule just doesn't fit in as this is a key based list.
Note that this does not change the IID of nsIDOMMozCSSKeyframesRule since neither the method signature nor semantics have changed; only the name is different.
Attachment #714728 - Flags: review?(bzbarsky)
Status: NEW → ASSIGNED
OS: Mac OS X → All
Priority: -- → P3
Hardware: x86 → All
Comment on attachment 714728 [details] [diff] [review] Rename CSSKeyframesRule.insertRule to appendRule to match spec change. r=me But shouldn't there be a way to insert keyframes in the middle too?
Attachment #714728 - Flags: review?(bzbarsky) → review+
If there are keys "0%" and "100%" then appendRule with key "50%" should actually insert keyframe in the middle (or set/replace style at 50% to match Presto behavior).
It appends the rule, but it's still a rule for 50%. The order of the rules inside @keyframes doesn't actually matter.
Sorry, I continued the conversation from GitHub and haven't noticed a missing reference :-). We were talking about Opera/Presto implementation here: https://github.com/jlongster/css-animations.js/issues/4 Opera is interpreting specs as there can be only one keyframe in the list with given key. It doesn't do any merge or anything, but simply replaces the style under given key. Seems legit to me given current spec. Maybe any of you could suggest spec. change (clarification at least)? :-)
^as if there could be...
> The order of the rules inside @keyframes doesn't actually matter. Ah, that's the key bit. Makes sense, then.
(In reply to Maciej Jaros from comment #8) > Opera is interpreting specs as there can be only one keyframe in the list > with given key. It doesn't do any merge or anything, but simply replaces the > style under given key. Seems legit to me given current spec. Maybe any of > you could suggest spec. change (clarification at least)? :-) Yes, that's what the current spec says, but I've proposed changing it, as described here: https://www.w3.org/Bugs/Public/show_bug.cgi?id=21018 , since I think it's very non-intuitive given how the rest of CSS works.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
You need to log in before you can comment on or make changes to this bug.