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

<img>.complete should take <source> elements into account #9346

Open
johannesodland opened this issue May 27, 2023 · 3 comments
Open

<img>.complete should take <source> elements into account #9346

johannesodland opened this issue May 27, 2023 · 3 comments

Comments

@johannesodland
Copy link

The specification for <img>.complete disregards image sources from a <source> element.

Given the following example. (Assume that the lazy load resumption steps and Fetch the image haven't been invoked yet.)

<picture>
  <source srcset='image.jpg'>
  <img loading='lazy'>
</picture>

Per spec <img>.complete should be true as the first bullet applies. Both the src and the srcset attribute on the image are omitted.

This seems a bit off.

The selected source is set to the the url from the <source> element, and the image lazy load resumption steps is set to fetch the image from the selected source at a later point.

In the source there's a comment that seems to indicate that it was intended to check sources in the <picture> parent:

<!--TODO: check picture parent-->

Should the spec be updated to account for the selected source?

Strictly, yes, the src attribute must be present on the <img> element, same as the sizes attribute must be present if srcset is set. But when the src attribute is omitted by authors, returning true would still be unexpected if there's a current request for a selected source who's state is not completely available or broken.

@RIYASANVI7

This comment was marked as spam.

@annevk
Copy link
Member

annevk commented Jun 14, 2023

We don't assign issues. You can open a PR when you have a fix.

@johannesodland
Copy link
Author

johannesodland commented Jun 20, 2023

This issue is related to #9181

If the src attribute is made optional, the getter steps for <img>.complete should be updated.

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

No branches or pull requests

3 participants