8000 Style sheets created from `<style>` elements have no location, which breaks CSS fetch algorithms · Issue #11281 · whatwg/html · GitHub
[go: up one dir, main page]

Skip to content

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

@AtkinsSJ

Description

@AtkinsSJ

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0