Skip to content

Style sheets created from <style> elements have no location, which breaks CSS fetch algorithms #11281

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

Open
AtkinsSJ opened this issue May 2, 2025 · 2 comments
Labels
integration Better coordination across standards needed topic: style

Comments

@AtkinsSJ
Copy link
Contributor

AtkinsSJ commented May 2, 2025

What is the issue with the HTML Standard?

This bug comes from interop between the HTML and CSS specs. I'm posting it here as I think the solution is to update the "update a style block" algorithm, but that's just my impression. (I've posted a stub spec issue there for visibility to CSSWG folks: w3c/csswg-drafts#12147)

Style sheets created from <style> elements have no location - see "update a style block"

This breaks multiple CSS fetch algorithms:

  • "Fetch an import" step 3 parses the URL using the style sheet's location - this fails for relative imports if there is no location set.
  • "Fetch a style resource" step 7 sets the fetch request's referrer to the sheet's location, which is unclear to me but seems to require an actual location.

As far as I can tell, the solution is to modify "update a style block" so that the location of the created style sheet is set to the document's base URL instead of null. I'm not seeing any regressions when doing this in Ladybird, but there might be nuances there I'm missing. Alternatively the CSS algorithms could be adjusted to handle the null-location case.

cc: @noamr as this is related to the other CSS fetch issues.

@AtkinsSJ
Copy link
Contributor Author

AtkinsSJ commented May 2, 2025

Stumbled across this too:

Style sheets embedded within a document have the base URL associated with their container.

@AtkinsSJ
Copy link
Contributor Author

AtkinsSJ commented May 7, 2025

Acid3 test 72, requires that <style> style sheets don't have a location, so that probably isn't something that can be changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration Better coordination across standards needed topic: style
Development

No branches or pull requests

2 participants