-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2931,6 +2931,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute | |
<li><dfn data-x="concept-DocumentFragment-host" data-x-href="https://dom.spec.whatwg.org/#concept-documentfragment-host">host</dfn> concept</li> | ||
<li>The <dfn data-x-href="https://dom.spec.whatwg.org/#concept-shadow-root">shadow root</dfn> concept, and its <dfn data-x-href="https://dom.spec.whatwg.org/#shadowroot-delegates-focus">delegates focus</dfn> and <dfn data-x-href="https://dom.spec.whatwg.org/#shadowroot-available-to-element-internals">available to element internals</dfn>.</li> | ||
<li>The <dfn data-x-href="https://dom.spec.whatwg.org/#element-shadow-host">shadow host</dfn> concept</li> | ||
<li>The <dfn data-x-href="https://dom.spec.whatwg.org/#concept">attribute</dfn> concept.</li> | ||
<li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-htmlcollection"><code>HTMLCollection</code></dfn> interface, its | ||
<dfn data-x="dom-HTMLCollection-length" data-x-href="https://dom.spec.whatwg.org/#dom-htmlcollection-length"><code>length</code></dfn> attribute, and its | ||
<dfn data-x="dom-HTMLCollection-item" data-x-href="https://dom.spec.whatwg.org/#dom-htmlcollection-item"><code>item()</code></dfn> and | ||
|
@@ -2982,7 +2983,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute | |
<dfn data-x="concept-node-remove-ext" data-x-href="https://dom.spec.whatwg.org/#concept-node-remove-ext">removing steps</dfn>, | ||
<dfn data-x="concept-node-adopt-ext" data-x-href="https://dom.spec.whatwg.org/#concept-node-adopt-ext">adopting steps</dfn>, and | ||
<dfn data-x-href="https://dom.spec.whatwg.org/#concept-node-children-changed-ext">children changed steps</dfn> hooks for elements</li> | ||
<li>The <dfn data-x="concept-element-attributes-change" data-x-href="https://dom.spec.whatwg.org/#concept-element-attributes-change">change</dfn>, <dfn data-x="concept-element-attributes-append" data-x-href="https://dom.spec.whatwg.org/#concept-element-attributes-append">append</dfn>, <dfn data-x="concept-element-attributes-remove" data-x-href="https://dom.spec.whatwg.org/#concept-element-attributes-remove">remove</dfn>, <dfn data-x="concept-element-attributes-replace" data-x-href="https://dom.spec.whatwg.org/#concept-element-attributes-replace">replace</dfn>, and <dfn data-x="concept-element-attributes-set-value" data-x-href="https://dom.spec.whatwg.org/#concept-element-attributes-set-value">set value</dfn> algorithms for attributes</li> | ||
<li>The <dfn data-x="concept-element-attributes-change" data-x-href="https://dom.spec.whatwg.org/#concept-element-attributes-change">change</dfn>, <dfn data-x="concept-element-attributes-append" data-x-href="https://dom.spec.whatwg.org/#concept-element-attributes-append">append</dfn>, <dfn data-x="concept-element-attributes-remove" data-x-href="https://dom.spec.whatwg.org/#concept-element-attributes-remove">remove</dfn>, <dfn data-x="concept-element-attributes-replace" data-x-href="https://dom.spec.whatwg.org/#concept-element-attributes-replace">replace</dfn>, <dfn data-x="concept-element-attributes-set-value" data-x-href="https://dom.spec.whatwg.org/#concept-element-attributes-set-value">set value</dfn>, and <dfn data-x="concept-element-attribute-has" data-x-href="https://dom.spec.whatwg.org/#concept-element-attribute-has">has</dfn> algorithms for attributes</li> | ||
<li>The <dfn data-x="concept-element-attributes-change-ext" data-x-href="https://dom.spec.whatwg.org/#concept-element-attributes-change-ext">attribute change steps</dfn> hook for attributes</li> | ||
<li>The <dfn data-x-href="https://dom.spec.whatwg.org/#concept-element-attribute">attribute list</dfn> concept</li> | ||
<li>The <dfn data-x="concept-cd-data" data-x-href="https://dom.spec.whatwg.org/#concept-cd-data">data</dfn> of a text node and its | ||
|
@@ -28722,9 +28723,15 @@ was an English <a href="/wiki/Music_hall">music hall</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 | ||
size</span> be the returned value.</p></li> | ||
<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> that is considered a <span>sizes attribute</span> for <var>child</var>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 Say: If child has a sizes attribute present, ... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, good catch. I've changed this. |
||
then set <var>sizesSource</var> to <var>child</var>.</p></li> | ||
|
||
<li><p><span data-x="parse a sizes attribute">Parse <var>sizesSource</var>'s sizes | ||
attribute</span>, and let <var>source set</var>'s <span>source size</span> be the returned | ||
value.</p></li> | ||
|
||
<li><p>If <var>child</var> has a <code data-x="attr-source-type">type</code> attribute, and its | ||
value is an unknown or unsupported <span>MIME type</span>, continue to the next child.</p></li> | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, see #5900