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

Add width and height attributes to source elements #5894

Merged
merged 38 commits into from
Feb 25, 2021

Conversation

yoavweiss
Copy link
Contributor

@yoavweiss yoavweiss commented Sep 7, 2020

This addresses #4968
I believe this has multi-implementer interest, based on #4968 (comment), but will let others comment to that effect.

This doesn't yet have tests, as I wanted to first verify the approach I took makes sense. I'll make sure tests are added before landing. Similarly, I'll make sure implementation bugs are opened.

/cc @zcorpan @annevk @domenic @chrishtr @emilio @jensimmons @cbiesinger

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


/embedded-content-other.html ( diff )
/embedded-content.html ( diff )
/images.html ( diff )
/indices.html ( diff )
/rendering.html ( diff )

@zcorpan
Copy link
Member

zcorpan commented Sep 7, 2020

Yay! 😄

I think the resource selection shouldn't "set an attribute value" on the img. Apart from invoking mutation observers, it also breaks markup that uses width and height on the img when the environment changes and it gets selected:

<picture>
 <source width=400 height=200 srcset="A" media="(min-width: 800px)">
 <img width=200 height=200 src="B" alt="">
</picture>

If A is first selected, the img will get its width changed to 400, and not changed back when the environment changes and B is selected.

Another detail to consider is when you want the dimension swap to happen. Should it happen when MQ changes (in the render step of the event loop), or when the new image is fully loaded? (For sizes, I believe it's MQ-time.)

@yoavweiss
Copy link
Contributor Author

I think the resource selection shouldn't "set an attribute value" on the img. Apart from invoking mutation observers, it also breaks markup that uses width and height on the img when the environment changes and it gets selected:

<picture>
 <source width=400 height=200 srcset="A" media="(min-width: 800px)">
 <img width=200 height=200 src="B" alt="">
</picture>

If A is first selected, the img will get its width changed to 400, and not changed back when the environment changes and B is selected.

What would be a better way to set those values on the img element? Change "if img's width and height attribute values" to take other values hanging off the element and modify those? Something else?

Another detail to consider is when you want the dimension swap to happen. Should it happen when MQ changes (in the render step of the event loop), or when the new image is fully loaded? (For sizes, I believe it's MQ-time.)

We definitely want this at MQ time, as the main goal here is to avoid layout shifts, by declaring the aspect ratio ahead of time.

@zcorpan
Copy link
Member

zcorpan commented Sep 7, 2020

@yoavweiss well so how dynamic should it be? If you update the width attribute on a source element, should it affect rendering (without causing "update the image data" to rerun)? I'm tempted to say yes. Which makes me think the img needs an internal property that points to the element that has the width and height attributes to use (either the img element itself or an earlier source sibling). And then the places that currently look at an img element's width and height attributes should use this indirection to get the right dimensions.

Then the interesting bit are the width and height IDL attributes. Getting them give the rendered dimensions. Setting them update the width and height attributes on the img -- which might not affect the rendering, and thus what the getters return. Should they also use the indirection on setting? And add new IDL that properly reflect width/height on img? It seems a bit risky to change what these setters do though.

@yoavweiss
Copy link
Contributor Author

The main use-case for which I think we care about this is the intrinsic aspect ratio calculations that I linked to above.
So maybe we can keep an internal property on img that will point at the right element containing the values required for that, but avoid messing with width and height getters and setters?

@zcorpan
Copy link
Member

zcorpan commented Sep 8, 2020

Sounds good to me

source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
@yoavweiss
Copy link
Contributor Author

@zcorpan - PTAL?

Copy link
Member

@zcorpan zcorpan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the aspect ratio, I think this should also update the Rendering section's mapping of the width and height attributes to the width and height properties (to use the "aspect ratio source"). Otherwise it will still use the img's width and height attributes to set the dimensions (without author CSS).

https://html.spec.whatwg.org/multipage/#attributes-for-embedded-content-and-images

source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
@mtrootyy
Copy link

mtrootyy commented Sep 8, 2020

Is it okay if the source element is not added to the following?

https://html.spec.whatwg.org/multipage/embedded-content-other.html#dimension-attributes

Author requirements: The width and height attributes on img, iframe, embed, object, video, and, when their type attribute is in the Image Button state, input elements may be specified to give the dimensions of the visual content of the element (the width and height respectively, relative to the nominal direction of the output medium), in CSS pixels. The attributes, if specified, must have values that are valid non-negative integers.

@zcorpan
Copy link
Member

zcorpan commented Sep 8, 2020

@mtrootyy it should be in there, but with the condition: when the parent is a picture. Good catch!

source Outdated Show resolved Hide resolved
@yoavweiss
Copy link
Contributor Author

Comments addressed. PTAL?

Copy link
Member

@zcorpan zcorpan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting there

source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
@zcorpan
Copy link
Member

zcorpan commented Sep 10, 2020

So I thought about a problem here.

What happens if you remove the aspect ratio source source element from the DOM?

It will be a "relevant mutation", which will invoke "update the image data". But that algorithm waits a microtask before invoking "selecting an image source". So before that happens, aspect ratio source points to a removed element. Maybe it's ok? If aspect ratio source is a strong reference, the source can't be garbage collected...

source Outdated
data-x="attr-input-type-image">Image Button</span> state and that either represents an image or
that the user expects will eventually represent an image, <span data-x="maps to the dimension
property">map to the dimension properties</span> <span>'width'</span> and <span>'height'</span>
on the element respectively.</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not quite sure this makes sense (or at least I don't think we have a precedent for this). This is saying that for:

<picture>
  <source srcset="bar.png" width="100" height="100">
  <img width="200" height="200">
</picture>

Something like getComputedStyle(img).width should be 100px, right? While I think this is the behavior you want, I'm not clear in how to accomplish it with the usual attribute mapping primitives.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. I think it's indeed new. But the mapping for 'aspect-ratio' would need this primitive as well, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For <source> yeah... with this patch, you also want to map to aspect-ratio somehow.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "intrinsic aspect ratio" bit does that, no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is not technically defined in terms of attribute mapping (and Chrome doesn't implement it that way, though Gecko does), that's why I didn't bring it up.

The reason for that is that when we initially added that section to the spec, we didn't have the CSS value we needed to map into. That value was added later, and we should update the spec to define it maps to aspect-ratio: <width> / <height> auto instead of changing the definition of "intrinsic aspect ratio".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha. Right. That does seem like a separate issue though. Can you file an issue?

@yoavweiss
Copy link
Contributor Author

So I thought about a problem here.

What happens if you remove the aspect ratio source source element from the DOM?

It will be a "relevant mutation", which will invoke "update the image data". But that algorithm waits a microtask before invoking "selecting an image source". So before that happens, aspect ratio source points to a removed element. Maybe it's ok? If aspect ratio source is a strong reference, the source can't be garbage collected...

That seems fine to me, but if that's not desired, maybe we could add a check to see that aspect ratiodimensions attribute source is connected?

@zcorpan
Copy link
Member

zcorpan commented Sep 29, 2020

Yeah I think it's fine. I just figured it's something that could crash if the UA doesn't hold a strong reference, and you force a reflow or something while aspect ratio source points to the removed element.

@cbiesinger
Copy link

So... how will this interact with the mapping of width/height to CSS that we now do?

Base automatically changed from master to main January 15, 2021 07:58
@yoavweiss
Copy link
Contributor Author

@cbiesinger - as far as I can tell, https://github.com/whatwg/html/pull/6032/files and this PR can peacefully co-exist :) Doesn't seem to me like they are conflicting in any way.

source Outdated
<p>The <code data-x="attr-dim-width">width</code> and <code
data-x="attr-dim-height">height</code> attributes may also be present. If present, their
values must contain valid lengths. The user agent will use these values to calculate the
<span>intrinsic aspect ratio</span> as well as the <span>intrinsic dimensions</span> of a

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a sidenote, setting this as the intrinsic ratio means this won't be used when contain:size is used (by definition, size containment ignores intrinsic size of images)

source Outdated
<p>The <code data-x="attr-dim-width">width</code> and <code
data-x="attr-dim-height">height</code> attributes may also be present. If present, their
values must contain valid lengths. The user agent will use these values to calculate the
<span>intrinsic aspect ratio</span> as well as the <span>intrinsic dimensions</span> of a
Copy link

@cbiesinger cbiesinger Jan 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I believe this text as written means that these attributes will override the actual dimensions of the image (once loaded); this is different from the behavior for img's attributes. Is that intentional?

Copy link
Member

@zcorpan zcorpan Jan 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this sentence uses the word "will" and not "must", it's a non-normative statement of fact and has no effect. The part about intrinsic dimensions (now named natural dimensions) I think is incorrect; the width and height attributes map to the 'width' and 'height' properties, which are the specified size, not natural dimensions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Corrected

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this refers to DOM properties? But an img's width/height properties also map to the attribute as well as the CSS width/height property... I don't even know how to implement this in a reasonable way...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mfreed7 in case he has input on that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, not the DOM properties. I think this sentence might be confusing matters, as it's not trying to require anything, but instead helpfully describing what purpose or effect the width and height attributes have. As an implementer, you can ignore non-normative statements completely. The normative part is in the Rendering section: https://whatpr.org/html/5894/16667c3...d10ef5c/rendering.html#attributes-for-embedded-content-and-images:attr-dim-width

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I also clarified the sentence, based on @zcorpan's feedback.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, thanks for clarifying that.

@cbiesinger
Copy link

I've put tests for this PR into web-platform-tests/wpt#27745, please review!

cbiesinger added a commit to cbiesinger/web-platform-tests that referenced this pull request Feb 23, 2021
cbiesinger added a commit to cbiesinger/web-platform-tests that referenced this pull request Feb 23, 2021
Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. I'll give folks another day or two before we merge?

source Show resolved Hide resolved
cbiesinger added a commit to cbiesinger/web-platform-tests that referenced this pull request Feb 24, 2021
@cbiesinger
Copy link

To complete the checklist here:

Implementation bugs:
https://bugs.chromium.org/p/chromium/issues/detail?id=1137794
https://bugzilla.mozilla.org/show_bug.cgi?id=1694741
https://bugs.webkit.org/show_bug.cgi?id=222368

Tests:
At web-platform-tests/wpt#27745 but will land as part of https://chromium-review.googlesource.com/c/chromium/src/+/2642939 (ie. web-platform-tests/wpt#27460)

@yoavweiss
Copy link
Contributor Author

@cbiesinger - Thanks! Updated the checklist up top

@domenic domenic merged commit c2d1a36 into whatwg:main Feb 25, 2021
@domenic domenic added addition/proposal New features or enhancements topic: img labels Feb 25, 2021
tremby added a commit to tremby/react-imgix that referenced this pull request Dec 24, 2022
[It's best practice to specify width and height on images][1], even if
they are fluid, to help avoid layout shift. It tells the browser the
expected size before it loads any image data, and an aspect ratio is
derived from it so the browser can still know the image size even if CSS
or something else is altering the image's width from its intrinsic one.

Before this patch, there was not a way to allow width and height
attributes to get through to the `img` element sent to the browser when
using the react-imgix component while leaving the image fluid width
(that is, with a srcset containing width descriptors). As soon as one
specified width and height, react-imgix assumed the author wanted a
fixed-width image, and it gave resolution descriptors in the srcset
instead of width descriptors (and then the sizes attribute was ignored
by the browser, [as per spec][2]).

Imgix currently uses the width and height attributes to decide whether
to use width or resolution descriptors, so to avoid altering that logic
(which would be a breaking change), this patch allows width and height
to be passed through the `htmlAttributes` prop. Prior to the patch they
were swallowed if given in `htmlAttributes`. As of this patch they are
allowed and passed through.

This closes imgix#891

In future it may make sense to decide srcset type based on the presence
of the `sizes` attribute, as discussed in the above ticket. This would
be a breaking change, however.

As part of this patch, width and height are also allowed through when
using this component in `Source` mode, since [width and height
attributes are now allowed and encouraged in that context][3].

[1]: https://web.dev/optimize-cls/
[2]: https://html.spec.whatwg.org/multipage/images.html#srcset-attributes
[3]: whatwg/html#5894
tremby added a commit to tremby/react-imgix that referenced this pull request Dec 24, 2022
[It's best practice to specify width and height on images][1], even if
they are fluid, to help avoid layout shift. It tells the browser the
expected size before it loads any image data, and an aspect ratio is
derived from it so the browser can still know the image size even if CSS
or something else is altering the image's width from its intrinsic one.

Before this patch, there was not a way to allow width and height
attributes to get through to the `img` element sent to the browser when
using the react-imgix component while leaving the image fluid width
(that is, with a srcset containing width descriptors). As soon as one
specified width and height, react-imgix assumed the author wanted a
fixed-width image, and it gave resolution descriptors in the srcset
instead of width descriptors (and then the sizes attribute was ignored
by the browser, [as per spec][2]).

Imgix currently uses the width and height attributes to decide whether
to use width or resolution descriptors, so to avoid altering that logic
(which would be a breaking change), this patch allows width and height
to be passed through the `htmlAttributes` prop. Prior to the patch they
were swallowed if given in `htmlAttributes`. As of this patch they are
allowed and passed through.

This closes imgix#891

In future it may make sense to decide srcset type based on the presence
of the `sizes` attribute, as discussed in the above ticket. This would
be a breaking change, however.

As part of this patch, width and height are also allowed through when
using this component in `Source` mode, since [width and height
attributes are now allowed and encouraged in that context][3].

[1]: https://web.dev/optimize-cls/
[2]: https://html.spec.whatwg.org/multipage/images.html#srcset-attributes
[3]: whatwg/html#5894
tremby added a commit to tremby/react-imgix that referenced this pull request Dec 24, 2022
[It's best practice to specify width and height on images][1], even if
they are fluid, to help avoid layout shift. It tells the browser the
expected size before it loads any image data, and an aspect ratio is
derived from it so the browser can still know the image size even if CSS
or something else is altering the image's width from its intrinsic one.

Before this patch, there was not a way to allow width and height
attributes to get through to the `img` element sent to the browser when
using the react-imgix component while leaving the image fluid width
(that is, with a srcset containing width descriptors). As soon as one
specified width and height, react-imgix assumed the author wanted a
fixed-width image, and it gave resolution descriptors in the srcset
instead of width descriptors (and then the sizes attribute was ignored
by the browser, [as per spec][2]).

Imgix currently uses the width and height attributes to decide whether
to use width or resolution descriptors, so to avoid altering that logic
(which would be a breaking change), this patch allows width and height
to be passed through the `htmlAttributes` prop. Prior to the patch they
were swallowed if given in `htmlAttributes`. As of this patch they are
allowed and passed through.

This closes imgix#891

In future it may make sense to decide srcset type based on the presence
of the `sizes` attribute, as discussed in the above ticket. This would
be a breaking change, however.

As part of this patch, width and height are also allowed through when
using this component in `Source` mode, since [width and height
attributes are now allowed and encouraged in that context][3].

[1]: https://web.dev/optimize-cls/
[2]: https://html.spec.whatwg.org/multipage/images.html#srcset-attributes
[3]: whatwg/html#5894
tremby added a commit to tremby/react-imgix that referenced this pull request Dec 24, 2022
[It's best practice to specify width and height on images][1], even if
they are fluid, to help avoid layout shift. It tells the browser the
expected size before it loads any image data, and an aspect ratio is
derived from it so the browser can still know the image size even if CSS
or something else is altering the image's width from its intrinsic one.

Before this patch, there was not a way to allow width and height
attributes to get through to the `img` element sent to the browser when
using the react-imgix component while leaving the image fluid width
(that is, with a srcset containing width descriptors). As soon as one
specified width and height, react-imgix assumed the author wanted a
fixed-width image, and it gave resolution descriptors in the srcset
instead of width descriptors (and then the sizes attribute was ignored
by the browser, [as per spec][2]).

Imgix currently uses the width and height attributes to decide whether
to use width or resolution descriptors, so to avoid altering that logic
(which would be a breaking change), this patch allows width and height
to be passed through the `htmlAttributes` prop. Prior to the patch they
were swallowed if given in `htmlAttributes`. As of this patch they are
allowed and passed through.

This closes imgix#891

In future it may make sense to decide srcset type based on the presence
of the `sizes` attribute, as discussed in the above ticket. This would
be a breaking change, however.

As part of this patch, width and height are also allowed through when
using this component in `Source` mode, since [width and height
attributes are now allowed and encouraged in that context][3].

[1]: https://web.dev/optimize-cls/
[2]: https://html.spec.whatwg.org/multipage/images.html#srcset-attributes
[3]: whatwg/html#5894
tremby added a commit to tremby/react-imgix that referenced this pull request Dec 24, 2022
[It's best practice to specify width and height on images][1], even if
they are fluid, to help avoid layout shift. It tells the browser the
expected size before it loads any image data, and an aspect ratio is
derived from it so the browser can still know the image size even if CSS
or something else is altering the image's width from its intrinsic one.

Before this patch, there was not a way to allow width and height
attributes to get through to the `img` element sent to the browser when
using the react-imgix component while leaving the image fluid width
(that is, with a srcset containing width descriptors). As soon as one
specified width and height, react-imgix assumed the author wanted a
fixed-width image, and it gave resolution descriptors in the srcset
instead of width descriptors (and then the sizes attribute was ignored
by the browser, [as per spec][2]).

Imgix currently uses the width and height attributes to decide whether
to use width or resolution descriptors, so to avoid altering that logic
(which would be a breaking change), this patch allows width and height
to be passed through the `htmlAttributes` prop. Prior to the patch they
were swallowed if given in `htmlAttributes`. As of this patch they are
allowed and passed through.

This closes imgix#891

In future it may make sense to decide srcset type based on the presence
of the `sizes` attribute, as discussed in the above ticket. This would
be a breaking change, however.

As part of this patch, width and height are also allowed through when
using this component in `Source` mode, since [width and height
attributes are now allowed and encouraged in that context][3].

[1]: https://web.dev/optimize-cls/
[2]: https://html.spec.whatwg.org/multipage/images.html#srcset-attributes
[3]: whatwg/html#5894
luqven pushed a commit to tremby/react-imgix that referenced this pull request Jan 10, 2023
[It's best practice to specify width and height on images][1], even if
they are fluid, to help avoid layout shift. It tells the browser the
expected size before it loads any image data, and an aspect ratio is
derived from it so the browser can still know the image size even if CSS
or something else is altering the image's width from its intrinsic one.

Before this patch, there was not a way to allow width and height
attributes to get through to the `img` element sent to the browser when
using the react-imgix component while leaving the image fluid width
(that is, with a srcset containing width descriptors). As soon as one
specified width and height, react-imgix assumed the author wanted a
fixed-width image, and it gave resolution descriptors in the srcset
instead of width descriptors (and then the sizes attribute was ignored
by the browser, [as per spec][2]).

Imgix currently uses the width and height attributes to decide whether
to use width or resolution descriptors, so to avoid altering that logic
(which would be a breaking change), this patch allows width and height
to be passed through the `htmlAttributes` prop. Prior to the patch they
were swallowed if given in `htmlAttributes`. As of this patch they are
allowed and passed through.

This closes imgix#891

In future it may make sense to decide srcset type based on the presence
of the `sizes` attribute, as discussed in the above ticket. This would
be a breaking change, however.

As part of this patch, width and height are also allowed through when
using this component in `Source` mode, since [width and height
attributes are now allowed and encouraged in that context][3].

[1]: https://web.dev/optimize-cls/
[2]: https://html.spec.whatwg.org/multipage/images.html#srcset-attributes
[3]: whatwg/html#5894
luqven pushed a commit to tremby/react-imgix that referenced this pull request Feb 2, 2023
[It's best practice to specify width and height on images][1], even if
they are fluid, to help avoid layout shift. It tells the browser the
expected size before it loads any image data, and an aspect ratio is
derived from it so the browser can still know the image size even if CSS
or something else is altering the image's width from its intrinsic one.

Before this patch, there was not a way to allow width and height
attributes to get through to the `img` element sent to the browser when
using the react-imgix component while leaving the image fluid width
(that is, with a srcset containing width descriptors). As soon as one
specified width and height, react-imgix assumed the author wanted a
fixed-width image, and it gave resolution descriptors in the srcset
instead of width descriptors (and then the sizes attribute was ignored
by the browser, [as per spec][2]).

Imgix currently uses the width and height attributes to decide whether
to use width or resolution descriptors, so to avoid altering that logic
(which would be a breaking change), this patch allows width and height
to be passed through the `htmlAttributes` prop. Prior to the patch they
were swallowed if given in `htmlAttributes`. As of this patch they are
allowed and passed through.

This closes imgix#891

In future it may make sense to decide srcset type based on the presence
of the `sizes` attribute, as discussed in the above ticket. This would
be a breaking change, however.

As part of this patch, width and height are also allowed through when
using this component in `Source` mode, since [width and height
attributes are now allowed and encouraged in that context][3].

[1]: https://web.dev/optimize-cls/
[2]: https://html.spec.whatwg.org/multipage/images.html#srcset-attributes
[3]: whatwg/html#5894
luqven pushed a commit to imgix/react-imgix that referenced this pull request Feb 2, 2023
[It's best practice to specify width and height on images][1], even if
they are fluid, to help avoid layout shift. It tells the browser the
expected size before it loads any image data, and an aspect ratio is
derived from it so the browser can still know the image size even if CSS
or something else is altering the image's width from its intrinsic one.

Before this patch, there was not a way to allow width and height
attributes to get through to the `img` element sent to the browser when
using the react-imgix component while leaving the image fluid width
(that is, with a srcset containing width descriptors). As soon as one
specified width and height, react-imgix assumed the author wanted a
fixed-width image, and it gave resolution descriptors in the srcset
instead of width descriptors (and then the sizes attribute was ignored
by the browser, [as per spec][2]).

Imgix currently uses the width and height attributes to decide whether
to use width or resolution descriptors, so to avoid altering that logic
(which would be a breaking change), this patch allows width and height
to be passed through the `htmlAttributes` prop. Prior to the patch they
were swallowed if given in `htmlAttributes`. As of this patch they are
allowed and passed through.

This closes #891

In future it may make sense to decide srcset type based on the presence
of the `sizes` attribute, as discussed in the above ticket. This would
be a breaking change, however.

As part of this patch, width and height are also allowed through when
using this component in `Source` mode, since [width and height
attributes are now allowed and encouraged in that context][3].

[1]: https://web.dev/optimize-cls/
[2]: https://html.spec.whatwg.org/multipage/images.html#srcset-attributes
[3]: whatwg/html#5894
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements agenda+ To be discussed at a triage meeting topic: img
Development

Successfully merging this pull request may close these issues.

8 participants