whatwg / whatwg/html

BaseURL is not specified correctly for CSS module scripts

Open
#11,629 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic: script
Dominant language
HTML
Stars
9.4k
Forks
3.2k
PR merge metrics
PR metrics pending

Description

What is the issue with the HTML Standard?

When constructing a CSS module script, Step 5 of the specification says "Let sheet be the result of running the steps to create a constructed CSSStyleSheet with an empty dictionary as the argument." and Step 2 of that specification says "Set sheet’s location to the base URL of the associated Document for the current global object.", but there's a web-platform test that checks that the BaseURL is the URI of the module script, not the document. The test was added here: https://github.com/web-platform-tests/wpt/pull/29408.

I ran into this while implementing CSS module scripts in Firefox (See https://bugzilla.mozilla.org/show_bug.cgi?id=1720570). I've implemented the behaviour that makes the test pass, but that doesn't seem correct according to the specification. I think in this case it makes sense to update the specification to match the test behaviour.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the HTML Standard's creating a CSS module script steps alongside CSSOM's create a constructed CSSStyleSheet steps. Run or inspect web-platform-tests/html/semantics/scripting-1/the-script-element/css-module/relative-urls.html and compare its expected module-script base URL with the specification. Done means the specification and test agree on the stylesheet location base URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.