You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Are you reporting to the correct repository? (there are multiple AngleSharp libraries, e.g., AngleSharp.Css for CSS support)
Did you perform a search in the issues?
For more information, see the CONTRIBUTING guide.
Description
Small numbers like 0.00001 get transformed into exponentials like 1E-05 due to internal value parsing. This does not happen with large numbers like 100000000.
Steps to Reproduce
Create a declaration containing a margin-left (could be any margin side) with a value of 0.00001px. I just used the first test on src\AngleSharp.Css.Tests\Declarations\CssMarginProperty.cs and changed it to my test values. It could be:
varsnippet="margin-left: 0.00001px";
In my project which consumes AngleSharp.Css I used CssParser.ParseStyleSheet() and inspecting the result, the property was in exponential format. This would skip the next two steps.
Parse the snippet with ParseDeclaration:
varproperty=ParseDeclaration(snippet);
Check that property value is now in exponential format.
Expected behavior: Output is margin-left: 0.00001px.
Actual behavior: Output is margin-left: 1E-05px. I wouldn't mind if I use the value to apply on CSS as it's semantically the same. The problem is that the use I give AngleSharp.Css is to clean bad styles on a general HTML, looking for malicious input. Users of my library expect to receive the same HTML they used as input to clean.
Bug Report
Prerequisites
AngleSharp.Css
for CSS support)For more information, see the
CONTRIBUTING
guide.Description
Small numbers like 0.00001 get transformed into exponentials like 1E-05 due to internal value parsing. This does not happen with large numbers like 100000000.
Steps to Reproduce
ParseDeclaration
:Expected behavior: Output is
margin-left: 0.00001px
.Actual behavior: Output is
margin-left: 1E-05px
. I wouldn't mind if I use the value to apply on CSS as it's semantically the same. The problem is that the use I give AngleSharp.Css is to clean bad styles on a general HTML, looking for malicious input. Users of my library expect to receive the same HTML they used as input to clean.Environment details: Windows 10, .NET Core 2.1, AngleSharp.Css 0.16.1, AngleSharp 0.16.0.
Possible Solution
This one is too deep for me; I don't know the internals of the project that much to propose a solution 😞
The text was updated successfully, but these errors were encountered: