Skip to content

Commit

Permalink
Make <img>.complete more reliable
Browse files Browse the repository at this point in the history
These changes are in line with all three browsers. Chrome still diverges significantly from the standard & tests though on other aspects.

Tests: web-platform-tests/wpt#19298.

Fixes #1055, fixes #4475. #4476 remains outstanding.
  • Loading branch information
annevk committed Sep 25, 2019
1 parent 1ab7c86 commit 9da1b2d
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -26519,7 +26519,6 @@ interface <dfn>HTMLImageElement</dfn> : <span>HTMLElement</span> {
any of the following conditions is true:</p>

<ul class="brief">

<!--TODO: check picture parent-->

<li>Both the <code data-x="attr-img-src">src</code> attribute and the <code
Expand All @@ -26530,23 +26529,17 @@ interface <dfn>HTMLImageElement</dfn> : <span>HTMLElement</span> {
hack for src="", not srcset=""; present but empty or bogus srcset="" still means complete=false
if it's not in the img-error state -->

<li>The final <span data-x="concept-task">task</span> that is <span data-x="queue a
task">queued</span> by the <span>networking task source</span> once the resource has been fetched
has been <span data-x="queue a task">queued</span>.

<li>The <code>img</code> element's <span>current request</span>'s <span
data-x="img-req-state">state</span> is <span data-x="img-all">completely available</span>.
data-x="img-req-state">state</span> is <span data-x="img-all">completely available</span> and its
<span>pending request</span> is null.

<li>The <code>img</code> element's <span>current request</span>'s <span
data-x="img-req-state">state</span> is <span data-x="img-error">broken</span>.

data-x="img-req-state">state</span> is <span data-x="img-error">broken</span> and its
<span>pending request</span> is null.
</ul>

<p>Otherwise, the attribute must return false.</p>

<p class="note">The value of <code data-x="dom-img-complete">complete</code> can thus change while
a <span data-x="concept-script">script</span> is executing.</p>

<p>The <dfn data-x="dom-img-currentSrc"><code>currentSrc</code></dfn> IDL attribute
must return the <code>img</code> element's <span>current request</span>'s <span data-x="img-req-url">current URL</span>.</p>

Expand All @@ -26573,7 +26566,8 @@ img.decode();</code></pre>
<ol>
<!-- TODO: much of this could be phrased entirely in terms of the current request if
https://github.com/whatwg/html/issues/1055 gets fixed. See
https://github.com/whatwg/html/pull/2332#issuecomment-278613713 -->
https://github.com/whatwg/html/pull/2332#issuecomment-278613713
XXX Domenic what to do about this comment? -->
<li>
<p>If any of the following conditions are true about this <code>img</code> element:</p>

Expand Down

0 comments on commit 9da1b2d

Please sign in to comment.