-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(): Parse use directive attribute issues #10053
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
@@ -12,6 +12,7 @@ export function parseStyleString( | |||
.replace(/;\s*$/, '') | |||
.split(';') | |||
.forEach((chunk) => { | |||
if (!chunk) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gloriousjob solves an issue with empty style attribute
Build Stats
|
test/visual/svg_import.js
Outdated
@@ -36,7 +36,7 @@ | |||
test: 'Svg import test ' + svgName, | |||
code: test, | |||
golden: svgName + '.png', | |||
percentage: 0.06, | |||
percentage: 0.04, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lowered the percentage of possible failures
Added a failing test for the use with classNames that i don't want to go into fixing now |
Description
When parsing a use element, the priority for attribute is from the original.
You can't override a fill or a stroke that are defined in the object you are referencing.
When style is in place, you have to merge by features not by attribute.
So the priority is as follow:
The parent element style fill takes precedence over the parent element fill attribute and they define the parent fill color.
If a parent fill color is defined, you can't change in any way the used element color.
We do that by encoding that color value in the use-cloned style.
Also refactored some code to be more terse