Skip to content

Support picture in the img complete getter steps#12629

Draft
johannesodland wants to merge 1 commit into
whatwg:mainfrom
johannesodland:remove-early-return-from-complete-steps
Draft

Support picture in the img complete getter steps#12629
johannesodland wants to merge 1 commit into
whatwg:mainfrom
johannesodland:remove-early-return-from-complete-steps

Conversation

@johannesodland

@johannesodland johannesodland commented Jun 28, 2026

Copy link
Copy Markdown

Solves: #9346

The HTMLImageElement complete getter steps currently return true if the src and srcset attributes are omitted from the img element, regardless of any parent picture element and sibling source elements. As a result,
the complete getter steps return true, even though there might be a current request with a state of Unavailable or Partially available.

This will give an unexpected result for authors that have provided source elements for a picture element, but omitted src and srcset on the img element.

This PR replaces the attribute based check with a check on the result of selecting an image source.

There is a separate issue to remove the requirement for a src or srcset on the img element: #11313

(See WHATWG Working Mode: Changes for more details.)


/embedded-content.html ( diff )

@johannesodland johannesodland force-pushed the remove-early-return-from-complete-steps branch from 8728a45 to 5956ead Compare June 30, 2026 18:02
@johannesodland johannesodland changed the title Remove early return from the img complete getter steps Support picture in the img complete getter steps Jun 30, 2026
Solves: whatwg#9346

The HTMLImageElement complete getter steps currently return true if the `src`
and `srcset` attributes are omitted from the `img` element, regardless of any
parent picture element and sibling source elements. As a result,
the complete getter steps return true, even though there might be a current
request with a state of `Unavailable` or `Partially available`.

This will give an unexpected result for authors that have provided
`source` elements for a `picture` element, but omitted `src` and `srcset`
on the `img` element.

This PR replaces the attribute based check with a check on the result of
`selecting an image source`.

There is a separate issue to remove the requirement for a `src` or `srcset`
on the `img` element: whatwg#11313
@johannesodland johannesodland force-pushed the remove-early-return-from-complete-steps branch from 5956ead to 9665a5b Compare June 30, 2026 18:08
johannesodland added a commit to johannesodland/wpt that referenced this pull request Jul 1, 2026
This PR adds test for img.complete in two areas:
- img src omitted srcset empty
- picture parent with source siblings

We lack interoperability in these two areas, and the current spec
lack support for a picture parent.

See: whatwg/html#9346

The expected results follow the suggested edit to the HTML spec,
aligning with the WebKit and Blink implementation:
whatwg/html#12629
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant