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

Skip to first unread message

Boris Chiou

Jul 22, 2022, 7:25:42 PMJul 22
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>.

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:

Reply all
Reply to author
0 new messages