AngleSharp.Css icon indicating copy to clipboard operation
AngleSharp.Css copied to clipboard

Missing unit on 0 values

Open truthz03 opened this issue 8 months ago • 0 comments

Prerequisites

  • [X] Can you reproduce the problem in a MWE?
  • [X] Are you running the latest version of AngleSharp.Css?
  • [X] Did you check the FAQs to see if that helps you?
  • [X] Are you reporting to the correct repository? (there are multiple AngleSharp libraries, e.g., AngleSharp.Xml for Xml support)
  • [X] Did you perform a search in the issues?

Description

Hi, I'm currently using AngleSharp.Css 0.17.0 but I also tried it with 1.0.0-beta.139. My problem is that when I parse .fx-flex { flex: 1 1 0% !important } and write it back to a string the % sign is lost. But if the % sign is missing flex will do a completely different thing.

Is there anything to configure to get the needed behaviour?

Another strange behaviour is, that we use our software inside a Linux Docker container and as windows service, but the missing units will be only a problem on Windows.

Steps to Reproduce

var parser = new CssParser(new CssParserOptions()
{
    IsIncludingUnknownDeclarations = true,
    IsIncludingUnknownRules = true,
    IsToleratingInvalidSelectors = true
});
var css = parser.ParseStyleSheetAsync(".fx-flex{flex:1 1 0%!important}", CancellationToken.None).Result;
var sb = new StringBuilder();
using (var writer = new StringWriter(sb))
{
    css.ToCss(writer, AngleSharp.Css.CssStyleFormatter.Instance);
}
var newCssString = sb.ToString();

Expected Behavior

newCssString should be: .fx-flex { flex: 1 1 0% !important }

Actual Behavior

newCssString is: .fx-flex { flex: 1 1 0 !important }

Possible Solution / Known Workarounds

No response

truthz03 avatar Jun 18 '24 08:06 truthz03