- From: Sam Atkins via GitHub <sysbot+gh@w3.org>
- Date: Fri, 11 Apr 2025 10:42:52 +0000
- To: public-css-archive@w3.org
AtkinsSJ has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-values] "fetch a style resource" should fall back to the CSSStyleSheet's location == In step 2 of ["fetch a style resource"]() we have: > Let base be sheet’s [stylesheet base URL](https://drafts.csswg.org/cssom-1/#concept-css-style-sheet-stylesheet-base-url) if it is not null, otherwise environmentSettings’s [API base URL](https://html.spec.whatwg.org/multipage/webappapis.html#api-base-url). [[CSSOM]](https://drafts.csswg.org/css-values-4/#biblio-cssom) However, only stylesheets constructed from JS have a base URL set. For those that don't, I believe we should fall back to sheet's [location](https://drafts.csswg.org/cssom-1/#concept-css-style-sheet-location), and only afterwards use the API base URL. As an example: ## index.html ```html <!DOCTYPE html> <style> @import url("data/sheet.css"); </style> <div id="checkerboard"></div> ``` ## data/sheet.css ```css #checkerboard { background: url("image.png"); } ``` With the current algorithm, sheet has no base URL, so it would fall back to the API base URL, which is the document's location. It would thus try to load `image.png` instead of `data/image.png`. Inserting the sheet's location as a fallback means that it would load relative to `data/sheet.css`, and so get `data/image.png`. Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12068 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 11 April 2025 10:42:53 UTC