Skip to content
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

Missing unit on 0 values #172

Open
5 tasks done
truthz03 opened this issue Jun 18, 2024 · 0 comments
Open
5 tasks done

Missing unit on 0 values #172

truthz03 opened this issue Jun 18, 2024 · 0 comments
Labels

Comments

@truthz03
Copy link

truthz03 commented Jun 18, 2024

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

@truthz03 truthz03 added the bug label Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant