Re: [whatwg/xhr] [do not merge] Specify target of progress events (#246)

jugglinmike commented on this pull request.

> A subclass of `XMLHttpRequestEventTarget` is `<b>this</b>` in most cases.

Understood. My confusion isn't so much about what `this` refers to--it's that I don't know which target is intended in each case. I've taken a first shot at this using a mix of inference and observation. Please take care to verify each as my guesswork is likely flawed.

Also, I'm referencing the term with the Bikeshed syntax, `[=this=]` so that it is cross-linked to WebIDL.

> @@ -809,7 +809,7 @@ method must run these steps:
   <p>If the <a>synchronous flag</a> is unset, then:
 
   <ol>
-   <li><p><a>Fire a progress event</a> named <a event><code>loadstart</code></a> with 0 and 0.
+   <li><p><a>Fire a progress event</a> named <a event><code>loadstart</code></a> at [=this=] with 0 and 0.

This seems like it should be the request object since a `loadstart` event is already being fired at the `XMLHttpRequestUpload` in the next step. However, since that's done conditionally and with different parameters, using `XMLHttpRequestUpload` wouldn't be completely redundant.

> @@ -957,7 +957,7 @@ method must run these steps:
         <a>state</a> changes.
 
        <li><p><a>Fire a progress event</a> named
-       <a event><code>progress</code></a> with <var>response</var>'s
+       <a event><code>progress</code></a> at [=this=] with <var>response</var>'s

The intended target isn't clear in context. Firefox, Chrome, Edge, and Safari all fire this event at the request object.

> @@ -1039,7 +1039,7 @@ method must run these steps:
  <a for=body>total bytes</a>.
 
  <li><p>If the <a>synchronous flag</a> is unset, <a>fire a progress event</a> named
- <a event><code>progress</code></a> with <var>transmitted</var> and <var>length</var>.
+ <a event><code>progress</code></a> at [=this=] with <var>transmitted</var> and <var>length</var>.

The intended target isn't clear in context. Firefox, Chrome, Edge, and Safari all fire this event at the request object.

> @@ -1048,9 +1048,11 @@ method must run these steps:
  <li><p><a>Fire an event</a> named <a event><code>readystatechange</code></a>.
 
  <li><p><a>Fire a progress event</a> named <a event><code>load</code></a>
+ at [=this=]

The intended target isn't clear in context. Firefox, Chrome, Edge, and Safari all fire this event at the request object.

>   with <var>transmitted</var> and <var>length</var>.
 
  <li><p><a>Fire a progress event</a> named <a event><code>loadend</code></a>
+ at [=this=]'s {{XMLHttpRequestUpload}} object

The intended target isn't clear in context. Firefox, Chrome, Edge, and Safari all fire this event at the request upload object.

> @@ -1122,10 +1124,10 @@ exception <var>exception</var> are:
   </ol>
 
  <li><p><a>Fire a progress event</a> named
- <var>event</var> with 0 and 0.
+ <var>event</var> at [=this=] with 0 and 0.

Since a corresponding event is fired at the request upload object in the previous step, I'm fairly certain the intended target here is the request object.

>  
  <li><p><a>Fire a progress event</a> named
- <a event><code>loadend</code></a> with 0 and 0.
+ <a event><code>loadend</code></a> at [=this=] with 0 and 0.

Since a corresponding event is fired at the request upload object in the previous step, I'm fairly certain the intended target here is the request object.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/xhr/pull/246#pullrequestreview-228496744

Received on Thursday, 18 April 2019 20:57:08 UTC