w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.38k stars 641 forks source link

[cssom] Important flag for declaration block in @keyframes rule #1824

Open upsuper opened 6 years ago

upsuper commented 6 years ago

In CSS Animations spec, it is mentioned that

In addition, properties qualified with !important are invalid and ignored.

However, the important flag can still be set via CSSStyleDeclaration's setProperty and setPropertyPriority.

Probably the "set a CSS declaration priority" algorithm should ignore when the declaration block is from a keyframe rule.

cc @hiikezoe

upsuper commented 6 years ago

Actually, it may be unrelated to css-animations at all. CSS Syntax also mentions

If they don’t interact with the cascade, properties containing !important are automatically invalid;

So probably CSSOM should say that if !important is invalid in a declaration block, "set a CSS declaration priority" fails or is ignored.

hiikezoe commented 6 years ago

Thanks for the clarification. Note for keyframes rules; 1) Chromium does not fail setProperty with 'important' and handles the property as if it's not 'important' 2) Firefox does not fail setProperty with 'important' and handles the new property in the keyframe is invalid (which means the new property overrides the old one).

Either does not comply the spec?