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

Take sizes from <img> if a <source> doesn't have a sizes attribute #6695

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jakearchibald
Copy link
Contributor

@jakearchibald jakearchibald commented May 19, 2021

Fixes #6633 by allowing sizes data to come from the <img> if a particular sibling <source> doesn't have a sizes attribute.

  • At least two implementers are interested (and none opposed):
  • Tests are written and can be reviewed and commented upon at:
  • Implementation bugs are filed:
    • Chrome: …
    • Firefox: …
    • Safari: …

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


/images.html ( diff )
/infrastructure.html ( diff )

@@ -28722,9 +28723,15 @@ was an English &lt;a href="/wiki/Music_hall">music hall&lt;/a> singer, ...</code
its value does not <span data-x="matches the environment">match the environment</span>,
continue to the next child.</p></li>

<li><p><span data-x="parse a sizes attribute">Parse <var>child</var>'s sizes attribute</span>
with the fallback width <var>width</var>, and let <var>source set</var>'s <span>source
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The "parse a sizes attribute" algorithm doesn't take a "fallback width" and there's no width variable in this algorithm. I assume this is left over from something?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, see #5900

<li><p>Let <var>sizesSource</var> be <var>el</var>.</p></li>

<li><p>If <var>child</var> <span data-x="concept-element-attribute-has">has</span> an
<span>attribute</span> whose <span>qualified name</span> is <code data-x="">"sizes"</code>,
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you should check the qualified name; it would pick up a namespaced attribute with that name (can be set with setAttributeNS()). Also, link's sizes attribute is named imagesizes.

Say: If child has a sizes attribute present, ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, good catch. I've changed this.

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.

Allow <source> to use <img>'s sizes data as a fallback
2 participants