Skip to content

fix(cleanupIds): don't skip IDs that were already reassigned - #2238

Open
victorvianna wants to merge 1 commit into
svg:mainfrom
victorvianna:main
Open

fix(cleanupIds): don't skip IDs that were already reassigned#2238
victorvianna wants to merge 1 commit into
svg:mainfrom
victorvianna:main

Conversation

@victorvianna

Copy link
Copy Markdown

The generator skips a candidate ID when it looks like a dangling external reference (#1815). Renaming an element deletes its old ID from nodeById, so IDs already reassigned during the pass matched that test too and were skipped, yielding non-consecutive IDs that changed again on a second pass.

Collect external references before any renaming, and guard separately against unreferenced IDs, which are kept when remove is disabled and otherwise led to duplicate IDs and references resolving to the wrong element.

Fixes #2237

The generator skips a candidate ID when it looks like a dangling external
reference (svg#1815). Renaming an element deletes its old ID from nodeById,
so IDs already reassigned during the pass matched that test too and were
skipped, yielding non-consecutive IDs that changed again on a second pass.

Collect external references before any renaming, and guard separately
against unreferenced IDs, which are kept when remove is disabled and
otherwise led to duplicate IDs and references resolving to the wrong
element.

Fixes svg#2237
@victorvianna

Copy link
Copy Markdown
Author

@SethFalco PTAL

@victorvianna

Copy link
Copy Markdown
Author

@TrySound Could you please approve the workflow runs when you have a chance? Happy to address any feedback.

@victorvianna

Copy link
Copy Markdown
Author

Thanks. The failure is unrelated to the CL

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cleanupIds: minified IDs are not idempotent and can collide

1 participant