fix(removeUnknownsAndDefaults): don't strip inherited attrs across ID boundaries - #2241
Open
victorvianna wants to merge 1 commit into
Open
victorvianna wants to merge 1 commit into
victorvianna wants to merge 1 commit into
Conversation
…ss ID boundaries Two independent uselessOverrides bugs, both from comparing an attribute against the parent's full computed style. 1. Inheritance was resolved through the whole ancestor chain, but an element with an `id` (or inside `<defs>`/`<symbol>`) may be instantiated by `<use>` somewhere else entirely, where the ancestors above it do not apply. Stop the walk at that boundary, keeping the boundary element itself since it is cloned along with the subtree. 2. The parent's own presentation attributes were all treated as inheritable. `presentationNonInheritableGroupAttrs` only covers eight of them, so `overflow`, `vector-effect`, `stop-color`, `stop-opacity`, `flood-color`, `clip`, `transform-origin` and friends leaked through and were dropped from children that legitimately carried them — e.g. `overflow` on a nested `<svg>`, which controls its clipping. Filter on `inheritableAttrs` instead. Both views of the cascade are collected in a single ancestor walk. Each level re-matches the whole stylesheet, so walking twice doubled the cost of the plugin on deep documents.
Author
|
@TrySound Could you please approve the workflow runs when you have a chance? Happy to address any feedback. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two independent uselessOverrides bugs, both from comparing an attribute against the parent's full computed style.
Inheritance was resolved through the whole ancestor chain, but an element with an
id(or inside<defs>/<symbol>) may be instantiated by<use>somewhere else entirely, where the ancestors above it do not apply. Stop the walk at that boundary, keeping the boundary element itself since it is cloned along with the subtree.The parent's own presentation attributes were all treated as inheritable.
presentationNonInheritableGroupAttrsonly covers eight of them, sooverflow,vector-effect,stop-color,stop-opacity,flood-color,clip,transform-originand friends leaked through and were dropped from children that legitimately carried them — e.g.overflowon a nested<svg>, which controls its clipping. Filter oninheritableAttrsinstead.Both views of the cascade are collected in a single ancestor walk. Each level re-matches the whole stylesheet, so walking twice doubled the cost of the plugin on deep documents.