Intent to prototype: width and height attributes on <source> elements

63 views
Skip to first unread message

Boris Chiou

unread,
Jul 22, 2022, 7:25:42 PM7/22/22
to dev-pl...@mozilla.org
Summary: I'd like to implement width and height attributes on HTML source elements, and map these two attributes into the style of the <img> elements who are using this <source>. These mapped attributes override the <img>'s width and height attributes in style, and aspect-ratio as well. The width and height attributes are used only when its parent element is <picture>.

Specification: https://html.spec.whatwg.org/multipage/embedded-content.html#the-source-element
Standards Body:
The <source> element's parent is a <picture> element
=> The source element supports dimension attributes. The img element can use the width and height attributes of a source element, instead of those on the img element itself, to determine its rendered dimensions and aspect-ratio, as defined in the Rendering section.

Platform coverage: All
Preference: dom.picture_source_dimension_attributes.enabled. I'd like to enable this on nightly only for now. If it is stable for a couple of cycles, I will ship it.
DevTools bug: No sure if we need this.
Other browsers:

Thanks,
Boris
Reply all
Reply to author
Forward
0 new messages