-
-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Labels
Description
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.Xmlfor Xml support) - Did you perform a search in the issues?
Description
In an inline style where a non-important declaration for the same property comes later that an important one, the non-important takes precedence, although the important one should take precedence.
Originally reported as mganss/HtmlSanitizer#587
Possibly related: #184
Steps to Reproduce
const string html = """
<p style="padding: 20px !important; font-size: 20px; padding: 0;">Test</p>
""";
var parser = new HtmlParser(new HtmlParserOptions { IsScripting = true }, BrowsingContext.New(Configuration.Default.WithCss(new CssParserOptions())));
var dom = parser.ParseDocument(html);
var p = dom.QuerySelector("p") as IHtmlParagraphElement;
var style = p.GetStyle().CssText; // -> "padding: 0; font-size: 20px"Expected Behavior
style is "padding: 20px !important; font-size: 20px"
Actual Behavior
style is "padding: 0; font-size: 20px"
Possible Solution / Known Workarounds
No response