Skip to content

Commit

Permalink
[] (0) Define the ordering of 'load' events in more pedantic detail.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@3038 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Apr 30, 2009
1 parent fd982c5 commit e7ba60f
Show file tree
Hide file tree
Showing 2 changed files with 168 additions and 70 deletions.
116 changes: 80 additions & 36 deletions index
Expand Up @@ -4995,14 +4995,14 @@

</ol></li>

<li><p>When the resource is available, <a href=#queue-a-task>queue a task</a>
that uses the resource as appropriate. If the resource can be
processed incrementally, as, for instance, with a progressively
interlaced JPEG or an HTML file, multiple tasks may be queued to
process the data as it is downloaded. The <a href=#task-source>task source</a>
for these tasks is the <a href=#networking-task-source>networking task source</a>.</p>
<!-- XXX make sure each use of 'fetch' defines what the appropriate
task is -->
<li><p>When the resource is available, or if there is an error of
some description, <a href=#queue-a-task>queue a task</a> that uses the resource
as appropriate. If the resource can be processed incrementally, as,
for instance, with a progressively interlaced JPEG or an HTML file,
additional tasks may be queued to process the data as it is
downloaded. The <a href=#task-source>task source</a> for these tasks is the
<a href=#networking-task-source>networking task source</a>.</p> <!-- XXX make sure each
use of 'fetch' defines what the appropriate task is -->

</ol><p class=note>The <a href=#application-cache>application cache</a> processing model
introduces some <a href=#changesToNetworkingModel>changes to the
Expand Down Expand Up @@ -10056,20 +10056,30 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0
followed and 404 responses must cause the external resource to not
be applied.)</p>

<!-- similar text in various places -->
<p>Fetching external resources must <a href=#delay-the-load-event>delay the load
event</a> of the element's document until the <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a
task">queued</a> by the <a href=#networking-task-source>networking task source</a> once
the resource has been <a href=#fetch title=fetch>fetched</a> (defined
below) has been run.</p>

<!-- the next paragraph is similar to text in the <style> section -->
<p>Once a resource <em>and any subresources it uses</em> have been
<a href=#fetch title=fetch>fetched</a>, if the loads were successful,
the user agent must <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple
event</a> called <code title=event-load><a href=#event-load>load</a></code> at the
<code><a href=#the-link-element>link</a></code> element. If the resource or one of its
subresources fails to completely load for any reason (e.g. DNS
error, HTTP 404 response, the connection being prematurely closed,
unsupported Content-Type), the user agent must instead <a href=#queue-a-task>queue a
task</a> to <a href=#fire-a-simple-event>fire a simple event</a> called <code title=event-error><a href=#event-error>error</a></code> at the <code><a href=#the-link-element>link</a></code>
<p>The <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a task">queued</a> by the <a href=#networking-task-source>networking task
source</a> once the resource has been <a href=#fetch title=fetch>fetched</a> must, if the loads were successful,
<a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> called
<code title=event-load><a href=#event-load>load</a></code> at the <code><a href=#the-link-element>link</a></code>
element; otherwise, if the resource or one of its subresources
failed to completely load for any reason (e.g. DNS error, HTTP 404
response, a connection being prematurely closed, unsupported
Content-Type), it must instead <a href=#queue-a-task>queue a task</a> to
<a href=#fire-a-simple-event>fire a simple event</a> called <code title=event-error><a href=#event-error>error</a></code> at the <code><a href=#the-link-element>link</a></code>
element. Non-network errors in processing the resource or its
subresources (e.g. CSS parse errors, PNG decoding errors) are not
failures for the purposes of this paragraph.</p>

<p>The <a href=#task-source>task source</a> for these tasks is the <a href=#dom-manipulation-task-source>DOM
manipulation task source</a>.</p>

<hr><p>Interactive user agents should provide users with a means to
<a href=#following-hyperlinks title="following hyperlinks">follow the hyperlinks</a>
created using the <code><a href=#the-link-element>link</a></code> element, somewhere within their
Expand Down Expand Up @@ -11043,7 +11053,12 @@ people expect to have work and what is necessary.
event</a> called <code title=event-error><a href=#event-error>error</a></code> at the
<code><a href=#the-style-element>style</a></code> element. Non-network errors in the processing of
the element's contents or its subresources (e.g. CSS parse errors)
are not failures for the purposes of this paragraph.</p>
are not failures for the purposes of this paragraph. The
<code><a href=#the-style-element>style</a></code> element must <a href=#delay-the-load-event>delay the load event</a> of
the element's document until one of these <a href=#concept-task title=concept-task>tasks</a> has been queued.</p>

<p>The <a href=#task-source>task source</a> for these tasks is the <a href=#dom-manipulation-task-source>DOM
manipulation task source</a>.</p>

</div>

Expand Down Expand Up @@ -11474,7 +11489,13 @@ people expect to have work and what is necessary.

</dl></li>

</ol><p><dfn id=when-a-script-completes-loading>When a script completes loading</dfn>: If the
</ol><!-- similar text in various places --><p>Fetching an external script must <a href=#delay-the-load-event>delay the load
event</a> of the element's document until the <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a
task">queued</a> by the <a href=#networking-task-source>networking task source</a> once
the resource has been <a href=#fetch title=fetch>fetched</a> (defined
below) has been run.</p>

<p><dfn id=when-a-script-completes-loading>When a script completes loading</dfn>: If the
<code><a href=#script>script</a></code> element was added to one of the lists mentioned
above and the document is still being parsed, then the parser
handles it. Otherwise, the UA must run the following steps as the
Expand Down Expand Up @@ -11577,10 +11598,7 @@ people expect to have work and what is necessary.

</ol></dd>

</dl><p>Fetching an external script must <a href=#delay-the-load-event>delay the load
event</a> of the element's document.</p>

<p><dfn id=executing-a-script-block title="executing a script block">Executing a script
</dl><p><dfn id=executing-a-script-block title="executing a script block">Executing a script
block</dfn>: When the steps above require that the script block be
executed, the user agent must act as follows:</p>

Expand Down Expand Up @@ -16881,8 +16899,11 @@ interface <dfn id=htmlimageelement>HTMLImageElement</dfn> : <a href=#htmlelement
the <i>base URI of the element</i> is the same as <a href="#the-document's-address">the
document's address</a>.</p>

<!-- same text in <input type=image> section and similar text elsewhere -->
<p>Fetching the image must <a href=#delay-the-load-event>delay the load event</a> of the
element's document.</p>
element's document until the <a href=#concept-task title=concept-task>task</a>
that is <a href=#queue-a-task title="queue a task">queued</a> by the
<a href=#networking-task-source>networking task source</a> once the resource has been <a href=#fetch title=fetch>fetched</a> (defined below) has been run.</p>

<p class=warning>This, unfortunately, can be used to perform a
rudimentary port scan of the user's local network (especially in
Expand Down Expand Up @@ -16953,6 +16974,9 @@ interface <dfn id=htmlimageelement>HTMLImageElement</dfn> : <a href=#htmlelement
to <a href=#fire-a-simple-event>fire a simple event</a> called <code title=event-error><a href=#event-error>error</a></code> on the <code><a href=#the-img-element>img</a></code>
element.</p>

<p>The <a href=#task-source>task source</a> for these tasks is the <a href=#dom-manipulation-task-source>DOM
manipulation task source</a>.</p>

<hr><p>What an <code><a href=#the-img-element>img</a></code> element represents depends on the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute and the <code title=attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute.</p>

<dl class=switch><dt>If the <code title=attr-img-src><a href=#attr-img-src>src</a></code> attribute is set
Expand Down Expand Up @@ -18669,14 +18693,26 @@ href="?audio"&gt;audio&lt;/a&gt; test instead.)&lt;/p&gt;</pre>
content</a>, the user agent must <a href=#resolve-a-url title="resolve a
url">resolve</a> the value of the attribute, relative to the
element, and if that is successful, should <a href=#fetch>fetch</a> the
resulting <a href=#absolute-url>absolute URL</a>, find and instantiate an
appropriate <a href=#plugin>plugin</a> based on the <a href=#concept-embed-type title=concept-embed-type>content's type</a>, and hand that
<a href=#plugin>plugin</a> the content of the resource, replacing any
resulting <a href=#absolute-url>absolute URL</a>. The <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a
task">queued</a> by the <a href=#networking-task-source>networking task source</a> once
the resource has been <a href=#fetch title=fetch>fetched</a> must find
and instantiate an appropriate <a href=#plugin>plugin</a> based on the
<a href=#concept-embed-type title=concept-embed-type>content's type</a>, and hand
that <a href=#plugin>plugin</a> the content of the resource, replacing any
previously instantiated plugin for the element. <!-- Note that this
doesn't happen when the base URL changes. --></p>

<p>Fetching the resource must <a href=#delay-the-load-event>delay the load event</a> of
the element's document.</p>
<!-- if we add load/error events, then replace the previous
paragraph with the text one: -->
<!-- similar text in various places -->
<!--<p>Fetching the resource must <span>delay the load event</span>
of the element's document until the final <span
title="concept-task">task</span> that is <span title="queue a
task">queued</span> by the <span>networking task source</span> once
the resource has been <span title="fetch">fetched</span> has been
run.</p>-->

<p>The <dfn id=concept-embed-type title=concept-embed-type>type of the content</dfn>
being embedded is defined as follows:</p>
Expand Down Expand Up @@ -18904,19 +18940,25 @@ href="?audio"&gt;audio&lt;/a&gt; test instead.)&lt;/p&gt;</pre>
<p>If that is successful, <a href=#fetch>fetch</a> the resulting
<a href=#absolute-url>absolute URL</a>.</p>

<p>The fetching of the resource must <a href=#delay-the-load-event>delay the load
event</a> of the element's document.</p>
<!-- similar text in various places -->
<p>Fetching the resource must <a href=#delay-the-load-event>delay the load event</a>
of the element's document until the <a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue a
task">queued</a> by the <a href=#networking-task-source>networking task source</a>
once the resource has been <a href=#fetch title=fetch>fetched</a>
(defined next) has been run.</p>

</li>

<li><p>If the resource is not yet available (e.g. because the
resource was not available in the cache, so that loading the
resource required making a request over the network), then jump
to the last step in the overall set of steps (fallback). When the
resource becomes available, or if the load fails, restart this
algorithm from this step. Resources can load incrementally; user
agents may opt to consider a resource "available" whenever enough
data has been obtained to begin processing the resource.</li>
to the last step in the overall set of steps (fallback). The
<a href=#concept-task title=concept-task>task</a> that is <a href=#queue-a-task title="queue
a task">queued</a> by the <a href=#networking-task-source>networking task source</a>
once the resource is available must restart this algorithm from
this step. Resources can load incrementally; user agents may opt
to consider a resource "available" whenever enough data has been
obtained to begin processing the resource.</li>

<li><p>If the load failed (e.g. the <a href=#url>URL</a> could not be
<a href=#resolve-a-url title="resolve a url">resolved</a>, there was an HTTP
Expand Down Expand Up @@ -31772,8 +31814,10 @@ interface <dfn id=htmlformelement>HTMLFormElement</dfn> : <a href=#htmlelement>H
<code title=attr-input-src><a href=#attr-input-src>src</a></code> attribute is set or
changed.</li> <!-- XXX define changed -->

</ul><p>Fetching the image must <a href=#delay-the-load-event>delay the load event</a> of the
element's document.</p>
</ul><!-- same text in <img> section and similar text elsewhere --><p>Fetching the image must <a href=#delay-the-load-event>delay the load event</a> of the
element's document until the <a href=#concept-task title=concept-task>task</a>
that is <a href=#queue-a-task title="queue a task">queued</a> by the
<a href=#networking-task-source>networking task source</a> once the resource has been <a href=#fetch title=fetch>fetched</a> (defined below) has been run.</p>

<p>If the image was successfully obtained, with no network errors,
and the image's type is a supported image type, and the image is a
Expand Down

0 comments on commit e7ba60f

Please sign in to comment.