-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Parsing CSS shorthand property containing variable as value #171
Comments
What's missing is what version of AngleSharp.Css you are running. Please add it. Thanks! |
I'm new to github too :), so I added the version info into the description. Is it ok or should I have added it elsewhere? (I didn't preview my original post, so after sending it, I noticed that white spaces have been collapsed between Name - Value "columns" in expected and actual behaviour) Thanks! |
This is okay. Note that the current version is |
Thanks for the info! I installed the packages (AngleSharp and AngleSharp.Css) via Nuget manager in Visual Studio and with prerelease checked, it shows AngleSharp 1.1.2 and AngleSharp.Css 1.0.0-alpha-99 as latest versions, however I can see the mentioned newer releases on nuget.org. I'll try to install them somehow. |
I installed AngleSharp.Css 1.0.0-beta.139 with Package Manager Console successfully, but the issue seems to persist. |
Prerequisites
AngleSharp.Xml
for Xml support)Description
I'm using version 1.0.0-alpha-99.
I try to replace CSS variables with actual value in a html file (I have a pdf export tool that can't handle css variables in the pre-generated html). I'm playing with AngleSharp(.Css) to parse the html file and see what can I do with it. First of all, I parsed the html content and checked the parsed style objects.
I noticed, that if a variable is used in a shorthand css property, Value is empty in all the longhand properties, even the simple ones (e.g 1px or solid, etc). If I parse a single css property (one of the longhand) with variable, Value is set correctly.
Sorry, if this is not a bug, but by design or if I'm using AngleSharp in the wrong way. I'm really new to it and I might have missed something.
Thanks for help!
Steps to Reproduce
new AngleSharp.Css.Parser.CssParser(new AngleSharp.Css.Parser.CssParserOptions() { IsIncludingUnknownDeclarations = true, IsIncludingUnknownRules = true, IsToleratingInvalidSelectors = true }).ParseDeclaration("border-bottom: 1px solid var(--pale-grey);")
new AngleSharp.Css.Parser.CssParser(new AngleSharp.Css.Parser.CssParserOptions() { IsIncludingUnknownDeclarations = true, IsIncludingUnknownRules = true, IsToleratingInvalidSelectors = true }).ParseDeclaration("border-bottom-color: var(--pale-grey);")
The same happens if I examine a document loaded with the following code, that contains a <style> node with similar css rules.
var config = AngleSharp.Configuration.Default.WithDefaultLoader(new LoaderOptions { IsResourceLoadingEnabled = true }).WithCss();
var context = BrowsingContext.New(config);
var document = context.OpenAsync(res => res.Content(File.ReadAllText(@"sample.html")));
Expected Behavior
longhand properties:
Name Value
border-bottom-width 1px
border-bottom-style solid
border-bottom-color var(--pale-grey)
single property:
Name Value
border-bottom-color var(--pale-grey)
Actual Behavior
Name Value
border-bottom-width
border-bottom-style
border-bottom-color
single property:
Name Value
border-bottom-color var(--pale-grey)
Possible Solution / Known Workarounds
No response
The text was updated successfully, but these errors were encountered: