Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MediaList for linked stylesheet defaults to none instead of all #133

Closed
spriest487 opened this issue Feb 1, 2023 · 1 comment
Closed

Comments

@spriest487
Copy link

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!

@FlorianRappl FlorianRappl added this to the v1.0 milestone Jun 14, 2023
@FlorianRappl
Copy link
Contributor

Implemented and part of the next preview / 1.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants