A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/AngleSharp/AngleSharp/issues/1184 below:

Link element source not loaded when element is appended to document · Issue #1184 · AngleSharp/AngleSharp · GitHub

Prerequisites Description

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.

Steps to Reproduce
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 Behavior

The link element is added to the document, but no request is made for the link's href URL.

Possible Solution / Known Workarounds

I 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