I'm not entirely sure if this is a bug but it doesn't seem to occur in browsers. The "
is unbalanced in the source so this might trigger the observed behavior.
This was originally reported in mganss/HtmlSanitizer#411
var html = @"<span style=""background-image: var(--urlSpellingErrorV2,url("https://www.example.com/))"">Ipsum</span>"; var conf = Configuration.Default.WithCss(new CssParserOptions { IsIncludingUnknownDeclarations = true, IsIncludingUnknownRules = true, IsToleratingInvalidSelectors = true, }); var parser = new HtmlParser(new HtmlParserOptions { IsScripting = true }, BrowsingContext.New(conf)); var dom = parser.ParseDocument(html); var span = dom.Body.Children[0]; var attr = span.GetAttribute("style"); // -> "background-image: var(--urlSpellingErrorV2,url(\"https://www.example.com/))" var style = span.GetStyle(); var cssText = style.CssText; // -> "background-image: var(--urlSpellingErrorV2,url(\"https://www.example.com/))\uffff"
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4