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 authored Oct 15, 2019
1 parent 876f1b7 commit 87fa719
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -26516,7 +26516,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 @@ -26527,23 +26526,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 @@ -26568,9 +26561,6 @@ img.decode();</code></pre>
</div>

<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 -->
<li>
<p>If any of the following conditions are true about this <code>img</code> element:</p>

Expand Down

0 comments on commit 87fa719

Please sign in to comment.