Skip to content
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

Lazy-loading of background-images #20

Open
Malvoz opened this issue May 15, 2019 · 3 comments
Open

Lazy-loading of background-images #20

Malvoz opened this issue May 15, 2019 · 3 comments

Comments

@Malvoz
Copy link

Malvoz commented May 15, 2019

Before opening w3c/csswg-drafts#3659, I had assumed loading-image-default-eager applies to CSS background-images and generated content. But I don't think that's mentioned anywhere. @ehsan-karamad have you given any thought to this?

@ehsan-karamad
Copy link

I would have to pass that question to @bengreenstein since IMO this is more of a loading attribute question. The policy, when disabled, should (almost always) treat unset or auto attribute values as lazy. It is almost always to open room for some user agent optimizations for certain images (e.g., small images). I am not quite sure how the loading attribute deals with background images.
cc @clelland.

@clelland
Copy link
Collaborator

I don't think that the loading attribute applies to CSS at all; as specced, it's only defined on img (and iframe) elements, and only affects their replaced content, not the background. If that spec were to change, (maybe by defining a parallel background-loading CSS property) then I think loading-image-default-eager should cover that as well, but that would have to be defined first.

@Malvoz Malvoz changed the title [loading-image-default-eager] background-images and generated content? Lazy-loading of background-images Aug 6, 2019
@clelland clelland transferred this issue from w3c/webappsec-permissions-policy Dec 1, 2020
@jsnkuhn
Copy link

jsnkuhn commented Jul 16, 2021

Questions about lazy-loading of CSS background-images come up pretty regularly on some of the CSS question discords.
Some random thoughts:

  1. Seems like the idea should be more generic, as in lazy loading of css images in general to cover background-image, border-image,mask-image, generated content images, etc.

  2. Not sure if something like image-loading: lazy; per element is what folks want or if something more granular like background-loading: lazy; or background-image-loading: lazy; is what folks are wanting. The the latter seems like it would need be able to individually control multiple background-images. As in don't lazy load a fallback gradient image but do lazy load a PNG background that lays on top of the gradient background.

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

4 participants