[csswg-drafts] [css-images] [css-values] Fetch algorithms require a style sheet, which may not exist (#12065)

AtkinsSJ has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-images] [css-values] Fetch algorithms require a style sheet, which may not exist ==
["fetch a style resource"](https://drafts.csswg.org/css-values-4/#fetch-a-style-resource) and thus ["fetch an external image for a stylesheet"](https://drafts.csswg.org/css-images-4/#fetch-an-external-image-for-a-stylesheet) require a non-null `CSSStyleSheet`. However, there may not *be* such a sheet. Specifically, presentational hints and style attributes.


 For example:

```html
<body background="image.png">
```

Here the `background` attribute sets `background-image`:
> When a [body](https://html.spec.whatwg.org/multipage/sections.html#the-body-element) element has a [background](https://html.spec.whatwg.org/multipage/obsolete.html#attr-background) attribute set to a non-empty value [...] the user agent is expected to treat the attribute as a [presentational hint](https://html.spec.whatwg.org/multipage/rendering.html#presentational-hints) setting the element's ['background-image'](https://drafts.csswg.org/css-backgrounds/#propdef-background-image) property to the return value.
> https://html.spec.whatwg.org/multipage/rendering.html#the-page:attr-background

As another example, inline styles:

```html
<div style="background-image: url('image.png')">
```

As far as I'm aware, neither of these have a `CSSStyleSheet` object associated with them. Seems like we should probably fall back to using the Document's base URL in these cases.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12065 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 10 April 2025 10:06:19 UTC