Skip to content

Commit

Permalink
Only dispatch readystatechange if readyState changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed May 13, 2013
1 parent 6818869 commit 972797f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 50 deletions.
Binary file removed .DS_Store
Binary file not shown.
45 changes: 19 additions & 26 deletions Overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<p><a class="logo" href="//www.whatwg.org/"><img alt="WHATWG" height="100" src="//resources.whatwg.org/logo-xhr.svg" width="100"></a>
<h1 class="head" id="xmlhttprequest-ls">XMLHttpRequest</h1>
<h2 class="no-num no-toc" id="living-standard-—-last-updated-2-may-2013">Living Standard — Last Updated 2 May 2013</h2>
<h2 class="no-num no-toc" id="living-standard-—-last-updated-13-may-2013">Living Standard — Last Updated 13 May 2013</h2>

<dl>
<dt>This Version:
Expand Down Expand Up @@ -36,7 +36,7 @@ <h2 class="no-num no-toc" id="living-standard-—-last-updated-2-may-2013">Livin
<p class="copyright"><a href="http://creativecommons.org/publicdomain/zero/1.0/" rel="license"><img alt="CC0" src="http://i.creativecommons.org/p/zero/1.0/80x15.png"></a>
To the extent possible under law, the editor has waived all copyright and
related or neighboring rights to this work. In addition, as of
2 May 2013, the editor has made this specification available
13 May 2013, the editor has made this specification available
under the
<a href="http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0" rel="license">Open Web Foundation Agreement Version 1.0</a>,
which is available at
Expand Down Expand Up @@ -696,9 +696,15 @@ <h4 id="the-open()-method"><span class="secno">4.6.1 </span>The <code title="">o
<li><p>Set <a href="#response-entity-body">response entity body</a> to null.
</ul>

<li><p>Change the state to <a href="#dom-xmlhttprequest-opened" title="dom-XMLHttpRequest-OPENED">OPENED</a>.
<li>
<p>If the state is not <a href="#dom-xmlhttprequest-opened" title="dom-XMLHttpRequest-OPENED">OPENED</a>, run these
substeps:

<li><p><a class="external" href="http://dom.spec.whatwg.org/#concept-event-fire" title="concept-event-fire">Fire an event</a> named <code title="event-xhr-readystatechange"><a href="#event-xhr-readystatechange">readystatechange</a></code>.
<ol>
<li><p>Change the state to <a href="#dom-xmlhttprequest-opened" title="dom-XMLHttpRequest-OPENED">OPENED</a>.

<li><p><a class="external" href="http://dom.spec.whatwg.org/#concept-event-fire" title="concept-event-fire">Fire an event</a> named <code title="event-xhr-readystatechange"><a href="#event-xhr-readystatechange">readystatechange</a></code>.
</ol>
</ol>


Expand Down Expand Up @@ -2360,54 +2366,41 @@ <h3 id="events"><span class="secno">4.8 </span>Events summary</h3>
<th>Event name</th>
<th>Interface</th>
<th>Dispatched when…</th>
</tr>
</thead>
<tbody>
<tr>
<td><dfn id="event-xhr-readystatechange" title="event-xhr-readystatechange"><code>readystatechange</code></dfn></td>
<td><code class="external"><a href="http://dom.spec.whatwg.org/#event">Event</a></code></td>
<td>The <code title="dom-XMLHttpRequest-readyState"><a href="#dom-xmlhttprequest-readystate">readyState</a></code>
attribute changes at some seemingly arbitrary times for historical
reasons.</td>
</tr>
<td>The <code title="dom-XMLHttpRequest-readyState"><a href="#dom-xmlhttprequest-readystate">readyState</a></code> attribute changes
value, except when it changes to <a href="#dom-xmlhttprequest-unsent" title="dom-XMLHttpRequest-UNSENT">UNSENT</a>.
<tr>
<td><dfn id="event-xhr-loadstart" title="event-xhr-loadstart"><code>loadstart</code></dfn></td>
<td><code><a href="#progressevent">ProgressEvent</a></code></td>
<td>When the request starts.</td>
</tr>
<td>The fetch initiates.
<tr>
<td><dfn id="event-xhr-progress" title="event-xhr-progress"><code>progress</code></dfn></td>
<td><code><a href="#progressevent">ProgressEvent</a></code></td>
<td>While sending and loading data.</td>
</tr>
<td>Transmitting data.
<tr>
<td><dfn id="event-xhr-abort" title="event-xhr-abort"><code>abort</code></dfn></td>
<td><code><a href="#progressevent">ProgressEvent</a></code></td>
<td>When the request has been aborted. For instance, by invoking the
<td>When the fetch has been aborted. For instance, by invoking the
<code title="dom-XMLHttpRequest-abort"><a href="#dom-xmlhttprequest-abort">abort()</a></code> method.</td>
</tr>
<tr>
<td><dfn id="event-xhr-error" title="event-xhr-error"><code>error</code></dfn></td>
<td><code><a href="#progressevent">ProgressEvent</a></code></td>
<td>When the request has failed.</td>
</tr>
<td>The fetch failed.
<tr>
<td><dfn id="event-xhr-load" title="event-xhr-load"><code>load</code></dfn></td>
<td><code><a href="#progressevent">ProgressEvent</a></code></td>
<td>When the request has successfully completed.</td>
</tr>
<td>The fetch succeeded.
<tr>
<td><dfn id="event-xhr-timeout" title="event-xhr-timeout"><code>timeout</code></dfn></td>
<td><code><a href="#progressevent">ProgressEvent</a></code></td>
<td>When the author specified timeout has passed before the request

This comment has been minimized.

Copy link
@Mouvedia

Mouvedia Jul 26, 2018

Shouldn't completed be succeeded/failed instead?
The typo probably originates from 972797f#diff-1feda49b40370635faef8b655f144f64L2397

  • it shouldn't timeout after onload
  • completed correspond to loadend
  • succeeded correspond to load
could complete.</td>
</tr>
<td>The author specified timeout has passed before the fetch completed.
<tr>
<td><dfn id="event-xhr-loadend" title="event-xhr-loadend"><code>loadend</code></dfn></td>
<td><code><a href="#progressevent">ProgressEvent</a></code></td>
<td>When the request has completed (either in success or failure).</td>
</tr>
</tbody>
<td>The fetch completed (success or failure).
</table>


Expand Down
41 changes: 17 additions & 24 deletions Overview.src.html
Original file line number Diff line number Diff line change
Expand Up @@ -648,9 +648,15 @@ <h4>The <code title>open()</code> method</h4>
<li><p>Set <span>response entity body</span> to null.
</ul>

<li><p>Change the state to <span title="dom-XMLHttpRequest-OPENED">OPENED</span>.
<li>
<p>If the state is not <span title="dom-XMLHttpRequest-OPENED">OPENED</span>, run these
substeps:

<li><p><span data-anolis-spec=dom title=concept-event-fire>Fire an event</span> named <code title=event-xhr-readystatechange>readystatechange</code>.
<ol>
<li><p>Change the state to <span title="dom-XMLHttpRequest-OPENED">OPENED</span>.

<li><p><span data-anolis-spec=dom title=concept-event-fire>Fire an event</span> named <code title=event-xhr-readystatechange>readystatechange</code>.
</ol>
</ol>


Expand Down Expand Up @@ -2312,54 +2318,41 @@ <h3 id="events">Events summary</h3>
<th>Event name</th>
<th>Interface</th>
<th>Dispatched when&hellip;</th>
</tr>
</thead>
<tbody>
<tr>
<td><dfn title="event-xhr-readystatechange"><code>readystatechange</code></dfn></td>
<td><code data-anolis-spec=dom>Event</code></td>
<td>The <code title="dom-XMLHttpRequest-readyState">readyState</code>
attribute changes at some seemingly arbitrary times for historical
reasons.</td>
</tr>
<td>The <code title="dom-XMLHttpRequest-readyState">readyState</code> attribute changes
value, except when it changes to <span title=dom-XMLHttpRequest-UNSENT>UNSENT</span>.
<tr>
<td><dfn title="event-xhr-loadstart"><code>loadstart</code></dfn></td>
<td><code>ProgressEvent</code></td>
<td>When the request starts.</td>
</tr>
<td>The fetch initiates.
<tr>
<td><dfn title="event-xhr-progress"><code>progress</code></dfn></td>
<td><code>ProgressEvent</code></td>
<td>While sending and loading data.</td>
</tr>
<td>Transmitting data.
<tr>
<td><dfn title="event-xhr-abort"><code>abort</code></dfn></td>
<td><code>ProgressEvent</code></td>
<td>When the request has been aborted. For instance, by invoking the
<td>When the fetch has been aborted. For instance, by invoking the
<code title="dom-XMLHttpRequest-abort">abort()</code> method.</td>
</tr>
<tr>
<td><dfn title="event-xhr-error"><code>error</code></dfn></td>
<td><code>ProgressEvent</code></td>
<td>When the request has failed.</td>
</tr>
<td>The fetch failed.
<tr>
<td><dfn title="event-xhr-load"><code>load</code></dfn></td>
<td><code>ProgressEvent</code></td>
<td>When the request has successfully completed.</td>
</tr>
<td>The fetch succeeded.
<tr>
<td><dfn title="event-xhr-timeout"><code>timeout</code></dfn></td>
<td><code>ProgressEvent</code></td>
<td>When the author specified timeout has passed before the request
could complete.</td>
</tr>
<td>The author specified timeout has passed before the fetch completed.
<tr>
<td><dfn title="event-xhr-loadend"><code>loadend</code></dfn></td>
<td><code>ProgressEvent</code></td>
<td>When the request has completed (either in success or failure).</td>
</tr>
</tbody>
<td>The fetch completed (success or failure).
</table>


Expand Down

0 comments on commit 972797f

Please sign in to comment.