AngleSharp.Css
for CSS support)When setting up the BrowsingContext with the default resource loader and loading an HTML document it loads any link
elements with stylesheets just fine. But when appending any new link
elements to the document they do not get loaded as expected.
var config = Configuration.Default
.WithCss()
.WithDefaultLoader(new LoaderOptions() { IsResourceLoadingEnabled = true });
var html = @"<!doctype html><body></body>";
var document = BrowsingContext.New(config).OpenAsync(m => m.Content(html));
var link = document.CreateElement("link");
link.SetAttribute(AttributeNames.Rel, "stylesheet");
link.SetAttribute(AttributeNames.Href, "/mock-stylesheet.css");
document.Body.AppendChild(link);
Expected Behavior
The newly added link element's source should be loaded by the default resource loader (and in this case the CSS stylesheet should be parsed).
Actual BehaviorThe link element is added to the document, but no request is made for the link's href URL.
Possible Solution / Known WorkaroundsI have a PR ready for this with a fix.
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