-
-
Notifications
You must be signed in to change notification settings - Fork 41
Unable to parse background-image #66
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
Comments
Also, is there a case where I don't have to provide a context? And/or it feels pretty weird to have to specify the options twice when it's on the context. |
I think your assumption is false. If this would be the problem then most of the unit tests would be broken. I think the problem is much more likely in the In any case I think there is an issue here. Thanks for the report. |
So yeah. The But since browsers still support this legacy syntax I've added it to AngleSharp.Css, too! |
@FlorianRappl Thanks for the update, I upgraded to 0.15 and I ran the test above (even changed it to nav {
background-color: rgba(255, 255, 255, 1);
background-image: ;
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#FFFFFF',EndColorStr='#eeeeee')
} I'd expect the content to round trip. |
HTML and CSS do not round trip. The serializations are not to preserve the original code, but rather to transport its interpretation. Regarding the issue: There is even a passing test for this (https://github.com/AngleSharp/AngleSharp.Css/blob/devel/src/AngleSharp.Css.Tests/Declarations/CssBackgroundProperty.cs#L701) so not sure what the problem here is. Feel free to dig into that. Contributions welcome! |
@FlorianRappl: I took the following modified test and debugged it some more. I noticed that the test
Seems like a fix may be if the value was not empty and the new value is empty don't set it? Previously to the latest version it returned all the declarations. Also it's kind of a what the heck is going on when you set a valid value and then it's empty. It took stepping into it to see it was running converters. Would be pretty nice to move the converters out of the setter. |
@FlorianRappl Can you please reopen this issue. |
I think the issue you posted is fixed. If you have a new issue / something else that is not working then please open another issue with a specific description. Best case is that you also supply a PR that we can properly merge it in. Thanks! |
This wasn't fixed but I tried to dig into it without knowing the code base that well, I also added two tests above that could be copy and pasted. |
^^ would it be possible to get the two tests I added to this project? |
Bug Report
Prerequisites
AngleSharp.Css
for CSS support)For more information, see the
CONTRIBUTING
guide.Description
[Description of the bug]
I noticed that after painstakenly trying to upgrade from 0.9 to the latest release that some of my styles were completely removed. I stepped through the parser and found what I believe is a bug.
Steps to Reproduce
Take the following CSS
Expected behavior: [What you expected to happen]
The above css rules are in the parsed result.
Actual behavior: [What actually happened]
Environment details: [OS, .NET Runtime, ...]
.NET 5, macOS (Latest)
Possible Solution
I think there is a logic bug in CSSParser.FillDeclarations (
AngleSharp.Css/src/AngleSharp.Css/Parser/CssBuilder.cs
Line 453 in 5d034bf
If you look at it it calls CollectTrivia (ignores whitespace etc..) so the first style shows up, then calls
CreateDeclarationWith
(AngleSharp.Css/src/AngleSharp.Css/Parser/CssBuilder.cs
Line 455 in 5d034bf
The text was updated successfully, but these errors were encountered: