Skip to content

Commit

Permalink
Update ExCSS to 4.2.2.
Browse files Browse the repository at this point in the history
- Corresponds to TylerBrinks/ExCSS#152.
  • Loading branch information
H1Gdev committed Sep 6, 2023
1 parent 4df54b3 commit 4af9f70
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Source/Svg.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="ExCSS" Version="4.1.4" />
<PackageReference Include="ExCSS" Version="4.2.2" />
<PackageReference Include="Fizzler" Version="1.2.1" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37">
<PrivateAssets>all</PrivateAssets>
Expand Down
4 changes: 2 additions & 2 deletions Source/SvgDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ public static SvgDocument Open(string path)
if (styles.Any())
{
var cssTotal = string.Join(Environment.NewLine, styles.Select(s => s.Content).ToArray());
var stylesheetParser = new StylesheetParser(true, true);
var stylesheetParser = new StylesheetParser(true, true, tolerateInvalidValues: true);
var stylesheet = stylesheetParser.Parse(cssTotal);

foreach (var rule in stylesheet.StyleRules)
Expand All @@ -457,7 +457,7 @@ public static SvgDocument Open(string path)
foreach (var elem in elemsToStyle)
foreach (var declaration in rule.Style)
{
elem.AddStyle(declaration.Name, declaration.Value, rule.Selector.GetSpecificity());
elem.AddStyle(declaration.Name, declaration.Original, rule.Selector.GetSpecificity());
}
}
catch (Exception ex)
Expand Down
4 changes: 2 additions & 2 deletions Source/SvgElementFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static SvgElementFactory()
private static readonly Dictionary<string, ElementInfo> availableElementsWithoutSvg;
private static readonly List<ElementInfo> availableElements;
#endif
private readonly StylesheetParser stylesheetParser = new StylesheetParser(true, true);
private readonly StylesheetParser stylesheetParser = new StylesheetParser(true, true, tolerateInvalidValues: true);

/// <summary>
/// Gets a list of available types that can be used when creating an <see cref="SvgElement"/>.
Expand Down Expand Up @@ -186,7 +186,7 @@ private void SetAttributes(SvgElement element, XmlReader reader, SvgDocument doc
var inlineSheet = stylesheetParser.Parse("#a{" + reader.Value + "}");
foreach (var rule in inlineSheet.StyleRules)
foreach (var declaration in rule.Style)
element.AddStyle(declaration.Name, declaration.Value, SvgElement.StyleSpecificity_InlineStyle);
element.AddStyle(declaration.Name, declaration.Original, SvgElement.StyleSpecificity_InlineStyle);
}
else if (prefix.Length == 0 && IsStyleAttribute(localName))
{
Expand Down

0 comments on commit 4af9f70

Please sign in to comment.