You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the issue is caused by to/from being interpreted as a TypeSelector in the AST, and then being stripped out because it's not in the whitelisted array of tags.
The text was updated successfully, but these errors were encountered:
SethFalco
changed the title
Removes required "to" key frames in animation
Removes required "to" and "from" key frames in animation
Dec 25, 2021
SethFalco
changed the title
Removes required "to" and "from" key frames in animation
Removes required "to" and "from" keyframe in animation
Dec 25, 2021
That's a pretty interesting bug. There is no a big deal that css-tree treated from/to as TypeSelector but CSSO should avoid applying usage filtering to @keyframe rules as well as for other special at-rules like @page (not the case for SVGO but still). I think to fix it we need add an additional check here that a rule don't belong to a special at-rule like @keyframe, @page etc.
When an SVG has key frames with
to
orfrom
, CSSO will remove them, which changes the animation.Expected Behavior
The
to
andfrom
frames should be preserved/converted, otherwise it modifies the animation.For example:
0%,to{clip-path:inset(84%0 0)}
, should not become0%{clip-path:inset(84%0 0)}
.Minimal Working Example
The SVG I'm optimizing in SVGO.
A minimal example (using my actual use-case) of how it's being passed to CSSO.
I think the issue is caused by
to
/from
being interpreted as aTypeSelector
in the AST, and then being stripped out because it's not in the whitelisted array oftags
.Before I do anything else, I'm wondering, is CSSTree correct to report that as a
TypeSelector
? 🤔This might be a bug in CSSTree, since
to
andfrom
aren't type selectors. (https://www.w3.org/TR/selectors-3/#type-selectors)If they had to be named, it'd probably fall under keyframe selectors, or
KeyframeSelector
. (https://www.w3.org/TR/css-animations-1/#typedef-keyframe-selector)Related
The text was updated successfully, but these errors were encountered: