Skip to content

Missing unit on 0 values #172

Open
Open
@truthz03

Description

@truthz03

Prerequisites

  • Can you reproduce the problem in a MWE?
  • Are you running the latest version of AngleSharp.Css?
  • Did you check the FAQs to see if that helps you?
  • Are you reporting to the correct repository? (there are multiple AngleSharp libraries, e.g., AngleSharp.Xml for Xml support)
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions