Skip to content

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

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 Apr 10, 2025 · 2 comments

Comments

@AtkinsSJ
Copy link
Contributor

"fetch a style resource" and thus "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:

<body background="image.png">

Here the background attribute sets background-image:

When a body element has a background attribute set to a non-empty value [...] the user agent is expected to treat the attribute as a presentational hint setting the element's 'background-image' property to the return value.
https://html.spec.whatwg.org/multipage/rendering.html#the-page:attr-background

As another example, inline styles:

<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.

@weinig
Copy link
Contributor

weinig commented Apr 15, 2025

cc @fantasai, @tabatkins, @noamr, @annevk

@noamr
Copy link
Collaborator

noamr commented Apr 17, 2025

We should pass either a sheet or an element here.
Happy to work on a PR once #12074 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants