A RetroSearch Logo

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

Search Query:

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

MediaList for linked stylesheet defaults to none instead of all · Issue #133 · AngleSharp/AngleSharp.Css · GitHub

Hi, first of all thank you for this project, I've only just started using it but it's a huge help.

I'm trying to load a document which has a stylesheet linked like so:

<link href="style.css" rel="stylesheet">

But calling GetComputedStyle on any element was returning nothing but the default styles. After some debugging I tracked it down the media type check - the medium for this loaded stylesheet was "all" but the IsInverse flag on the medium is true, so it's never valid.

I think the problem might be this line in StyleSheetRequestProcessor.cs where the default for a link with no explicit media type is set to the empty string:

sheet.Media.MediaText = _link.Media ?? String.Empty;

While in MediaList.cs, the type only uses the default of "all" if the value passed in is actually null:

var media = MediaParser.Parse(value ?? CssKeywords.All, ValidatorFactory);

It seems like perhaps this check should be for null or an empty string, or maybe that StyleSheetRequestProcessor should pass in a null when no value is present?

Thanks for your time!


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