Skip to content

prefixIds does not apply prefix in non-trivial begin/end expressions of animate tag #2073

Open
@alex-kowalczyk

Description

Describe the bug
Seems that #848 is fixed only partially, for simple expressions - the fixing commit splits by '; ' and checks for .end presence via endsWith() , and follow-up changes drag that limitation too:
https://github.com/svg/svgo/blame/main/plugins/prefixIds.js#L253

For the following example, being a fragment of animation of rain drops, coming from https://github.com/basmilius/weather-icons (partly-cloudy-day-rain.svg):

<animate id="y1" attributeName="opacity" begin="0s; y1.end+.33s" dur=".67s" keyTimes="0; .25; 1" values="0; 1; 0"/>

the result is:

<animate id="partly-cloudy-day-rain_svg__j" attributeName="opacity" begin="0s; j.end+.33s" dur=".67s" keyTimes="0; .25; 1" values="0; 1; 0"></animate>

To Reproduce
Steps to reproduce the behavior:

Expected behavior

<animate id="partly-cloudy-day-rain_svg__j" attributeName="opacity" begin="0s; partly-cloudy-day-rain_svg__j.end+.33s" dur=".67s" keyTimes="0; .25; 1" values="0; 1; 0"></animate>

Desktop (please complete the following information):

  • SVGO Version: 3.3.2
  • NodeJs Version: 20
  • OS: Linux

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions