[html5] r3462 - [] (0) Change how media elements load resources again, to make it treat src= and [...]

whatwg at whatwg.org whatwg at whatwg.org
Sat Jul 25 20:05:48 PDT 2009


Author: ianh
Date: 2009-07-25 20:05:46 -0700 (Sat, 25 Jul 2009)
New Revision: 3462

Modified:
   index
   source
Log:
[] (0) Change how media elements load resources again, to make it treat src= and <source> in more similar ways.

Modified: index
===================================================================
--- index	2009-07-24 20:16:24 UTC (rev 3461)
+++ index	2009-07-26 03:05:46 UTC (rev 3462)
@@ -71,7 +71,7 @@
   <div class=head>
    <p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
    <h1>HTML 5</h1>
-   <h2 class="no-num no-toc" id=draft-standard-—-date:-01-jan-1901>Draft Standard — 24 July 2009</h2>
+   <h2 class="no-num no-toc" id=draft-standard-—-date:-01-jan-1901>Draft Standard — 26 July 2009</h2>
    <p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
    <p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
    <!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
@@ -20217,6 +20217,13 @@
 
   <div class=impl>
 
+  <p>If a <code><a href=#the-source-element>source</a></code> element is inserted as a child of a
+  <a href=#media-element>media element</a> that is <a href=#in-a-document>in a
+  <code>Document</code></a> and whose <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> has the value
+  <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, the user
+  agent must invoke the <a href=#media-element>media element</a>'s <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+  algorithm</a>.</p>
+
   <p>The DOM attributes <dfn id=dom-source-src title=dom-source-src><code>src</code></dfn>, <dfn id=dom-source-type title=dom-source-type><code>type</code></dfn>, and <dfn id=dom-source-media title=dom-source-media><code>media</code></dfn> must
   <a href=#reflect>reflect</a> the respective content attributes of the same
   name.</p>
@@ -20436,6 +20443,14 @@
 
   <div class=impl>
 
+  <p>If a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute of a
+  <a href=#media-element>media element</a> that is <a href=#in-a-document>in a
+  <code>Document</code></a> and whose <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> has the value
+  <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> is set or
+  changed, the user agent must invoke the <a href=#media-element>media element</a>'s
+  <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
+  algorithm</a>.</p>
+
   <p>The <dfn id=dom-media-src title=dom-media-src><code>src</code></dfn> DOM
   attribute on <a href=#media-element title="media element">media elements</a> must
   <a href=#reflect>reflect</a> the respective content attribute of the same
@@ -20718,75 +20733,66 @@
   remaining steps asynchronously, meaning that it runs in the
   background with scripts and other <a href=#concept-task title=concept-task>tasks</a> running in parallel.</p>
 
-  <ol><li>
+  <ol><li><p>Set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_NO_SOURCE><a href=#dom-media-network_no_source>NETWORK_NO_SOURCE</a></code>.</li>
 
-    <p>If the <a href=#media-element>media element</a> has neither a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute nor any
-    <code><a href=#the-source-element>source</a></code> element children, run these substeps:</p>
+   <li><p>Asynchronously <a href=#await-a-stable-state>await a stable state</a>, allowing
+   the <a href=#concept-task title=concept-task>task</a> that invoked this
+   algorithm to continue. The <a href=#synchronous-section>synchronous section</a>
+   consists of all the remaining steps of this algorithm until the
+   algorithm says the <a href=#synchronous-section>synchronous section</a> has
+   ended. (Steps in <a href=#synchronous-section title="synchronous section">synchronous
+   sections</a> are marked with ⌛.)</li>
 
-    <ol><li><p>Set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_NO_SOURCE><a href=#dom-media-network_no_source>NETWORK_NO_SOURCE</a></code>.</li>
+   <li>
 
-     <li><p>Run the remainder of the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
-     algorithm</a> steps asynchronously, allowing the <a href=#concept-task title=concept-task>task</a> that invoked this algorithm to
-     continue.</li>
+    <p>⌛ If the <a href=#media-element>media element</a> has a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute, then let <var title="">mode</var> be <i title="">attribute</i>.</p>
 
-     <li><p>While the <a href=#media-element>media element</a> has neither a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute nor any
-     <code><a href=#the-source-element>source</a></code> element children, wait. (This step might wait
-     forever.)</li>
+    <p>⌛ Otherwise, if the <a href=#media-element>media element</a> does not
+    have a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute but has a
+    <code><a href=#the-source-element>source</a></code> element child, then let <var title="">mode</var> be <i title="">children</i> and let <var title="">candidate</var> be the first such <code><a href=#the-source-element>source</a></code>
+    element child in <a href=#tree-order>tree order</a>.</p>
 
-     <li><p>Before the <a href=#concept-task title=concept-task>task</a> that set
-     the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute or inserted
-     the <code><a href=#the-source-element>source</a></code> element has a chance to complete, set the
-     <a href=#media-element>media element</a>'s <a href=#delaying-the-load-event-flag>delaying-the-load-event
-     flag</a> to true (this <a href=#delay-the-load-event title="delay the load
-     event">delays the load event</a>), and set its <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</li>
+    <p>⌛ Otherwise the <a href=#media-element>media element</a> has neither a
+    <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute nor a
+    <code><a href=#the-source-element>source</a></code> element child: set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, and abort
+    these steps; the <a href=#synchronous-section>synchronous section</a> ends.</p>
 
-     <li><p>If a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute was
-     set before a <code><a href=#the-source-element>source</a></code> element was inserted, let <var title="">src</var> equal the first value that was assigned to the
-     <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute after this
-     algorithm was invoked.</li>
+   </li>
 
-    </ol><p>Otherwise, run these substeps:</p>
+   <li><p>⌛ Set the <a href=#media-element>media element</a>'s
+   <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> to true (this <a href=#delay-the-load-event title="delay the load event">delays the load event</a>), and set
+   its <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to
+   <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</li>
 
-    <ol><li><p>Set the <a href=#media-element>media element</a>'s
-     <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a> to true (this <a href=#delay-the-load-event title="delay the load event">delays the load event</a>), and
-     set its <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code>
-     to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</li>
-
-     <li><p>If the <a href=#media-element>media element</a> has a <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute, let <var title="">src</var> equal the value of that attribute.</li>
-
-     <li><p>Run the remainder of the <a href=#concept-media-load-algorithm title=concept-media-load-algorithm>resource selection
-     algorithm</a> steps asynchronously, allowing the <a href=#concept-task title=concept-task>task</a> that invoked this algorithm to
-     continue.</li>
-
-    </ol></li>
-
-   <li><p class=note>By this point, the algorithm is running
-   asynchronously.</li>
-
-   <li><p><a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-progress-event>fire a progress
+   <li><p>⌛ <a href=#queue-a-task>Queue a task</a> to <a href=#fire-a-progress-event>fire a progress
    event</a> called <code title=event-loadstart><a href=#event-loadstart>loadstart</a></code>
    at the <a href=#media-element>media element</a>.</li>
 
    <li>
 
-    <p>If <var title="">src</var> was given a value in the earlier
-    steps, then run these substeps:</p>
+    <p>If <var title="">mode</var> is <i title="">attribute</i>, then
+    run these substeps:</p>
 
-    <ol><li><p>Let <var title="">absolute URL</var> be the <a href=#absolute-url>absolute
-     URL</a> that would have resulted from <a href=#resolve-a-url title="resolve a
-     url">resolving</a> the <a href=#url>URL</a> given by <var title="">src</var> relative to the <a href=#media-element>media element</a>
-     when the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute was
-     set to <var title="">src</var>.</p> <!-- i.e. changing xml:base
-     or <base> after src="" has no effect -->
+    <ol><li><p>⌛ Let <var title="">absolute URL</var> be the
+     <a href=#absolute-url>absolute URL</a> that would have resulted from <a href=#resolve-a-url title="resolve a url">resolving</a> the <a href=#url>URL</a>
+     specified by the <code title=attr-media-src><a href=#attr-media-src>src</a></code>
+     attribute's value relative to the <a href=#media-element>media element</a> when
+     the <code title=attr-media-src><a href=#attr-media-src>src</a></code> attribute was last
+     changed.</p> <!-- i.e. changing xml:base or <base> after src=""
+     has no effect -->
 
-     <li><p>If <var title="">absolute URL</var> was successfully
-     obtained, then run the <a href=#concept-media-load-resource title=concept-media-load-resource>resource fetch
+     <li><p>End the <a href=#synchronous-section>synchronous section</a>, continuing the
+     remaining steps asynchronously.</li>
+
+     <li><p>If <var title="">absolute URL</var> was obtained
+     successfully, run the <a href=#concept-media-load-resource title=concept-media-load-resource>resource fetch
      algorithm</a> with <var title="">absolute URL</var>. If that
      algorithm returns without aborting <em>this</em> one, then the
      load failed.</li>
 
-     <li><p>Reaching this step indicates that either the URL failed to
-     resolve, or the media resource failed to load. Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code> attribute to a new
+     <li><p>Reaching this step indicates that the media resource
+     failed to load or that the given <a href=#url>URL</a> could not be
+     <a href=#resolve-a-url title="resolve a url">resolved</a>. Set the <code title=dom-media-error><a href=#dom-media-error>error</a></code> attribute to a new
      <code><a href=#mediaerror>MediaError</a></code> object whose <code title=dom-MediaError-code><a href=#dom-mediaerror-code>code</a></code> attribute is set to <code title=dom-MediaError-MEDIA_ERR_SRC_NOT_SUPPORTED><a href=#dom-mediaerror-media_err_src_not_supported>MEDIA_ERR_SRC_NOT_SUPPORTED</a></code>.</li>
 
      <li><p>Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
@@ -20810,16 +20816,14 @@
 
     <ol><li>
 
-      <p>Let <var title="">pointer</var> be a position defined by two
-      adjacent nodes in the <a href=#media-element>media element</a>'s child list,
-      treating the start of the list (before the first child in the
-      list, if any) and end of the list (after the last child in the
-      list, if any) as nodes in their own right. One node is the node
-      before <var title="">pointer</var>, and the other node is the
-      node after <var title="">pointer</var>. Initially, let <var title="">pointer</var> be the position between the start of the
-      list and the next node (either the first child node of the
-      <a href=#media-element>media element</a>, if there are any, or the end of the
-      list, if it is empty).</p>
+      <p>⌛ Let <var title="">pointer</var> be a position
+      defined by two adjacent nodes in the <a href=#media-element>media
+      element</a>'s child list, treating the start of the list
+      (before the first child in the list, if any) and end of the list
+      (after the last child in the list, if any) as nodes in their own
+      right. One node is the node before <var title="">pointer</var>,
+      and the other node is the node after <var title="">pointer</var>. Initially, let <var title="">pointer</var> be the position between the <var title="">candidate</var> node and the next node, if there are
+      any, or the end of the list, if it is the last node.</p>
 
       <p>As elements are inserted and removed into the <a href=#media-element>media
       element</a>, <var title="">pointer</var> must be updated as
@@ -20852,105 +20856,99 @@
 
      </li>
 
-     <li>
+     <li><p>⌛ <i>Process candidate</i>: If <var title="">candidate</var> does not have a <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute, then end the
+     <a href=#synchronous-section>synchronous section</a>, and jump down to the <i title="">failed</i> step below.</li>
 
-      <p><i>Search loop</i>: <a href=#queue-a-task>Queue a task</a> to run the
-      following steps (so that no other tasks are running that could
-      make the DOM change while these steps are running):</p>
+     <li><p>⌛ Let <var title="">absolute URL</var> be the
+     <a href=#absolute-url>absolute URL</a> that would have resulted from <a href=#resolve-a-url title="resolve a url">resolving</a> the <a href=#url>URL</a>
+     specified by <var title="">candidate</var>'s <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute's value relative to
+     the <var title="">candidate</var> when the <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute was last
+     changed.</p> <!-- i.e. changing xml:base or <base> after src=""
+     has no effect -->
 
-      <ol><li><p>Let <var title="">candidate</var> be null.</li>
+     <li><p>⌛ If <var title="">absolute URL</var> was not
+     obtained successfully, then end the <a href=#synchronous-section>synchronous
+     section</a>, and jump down to the <i title="">failed</i> step
+     below.</li>
 
-       <li><p>If the node after <var title="">pointer</var> is the end
-       of the list, then abort the task.</li>
+     <li><p>⌛ If <var title="">candidate</var> has a <code title=attr-source-type><a href=#attr-source-type>type</a></code> attribute whose value, when
+     parsed as a MIME type (including any codecs described by the
+     <code title="">codec</code> parameter), represents <a href=#a-type-that-the-user-agent-knows-it-cannot-render>a type
+     that the user agent knows it cannot render</a>, then end the
+     <a href=#synchronous-section>synchronous section</a>, and jump down to the <i title="">failed</i> step below.</li>
 
-       <li><p>If the node after <var title="">pointer</var> is a
-       <code><a href=#the-source-element>source</a></code> element, let <var title="">candidate</var>
-       be that element.</li>
+     <li><p>⌛ If <var title="">candidate</var> has a <code title=attr-source-media><a href=#attr-source-media>media</a></code> attribute whose value,
+     when processed according to the rules for <a href=#mq>media
+     queries</a>, does not match the current environment, then end the
+     <a href=#synchronous-section>synchronous section</a>, and jump down to the <i title="">failed</i> step below. <a href=#refsMQ>[MQ]</a></li>
 
-       <li><p>Advance <var title="">pointer</var> so that the node
-       before <var title="">pointer</var> is now the node that was
-       after <var title="">pointer</var>, and the node after <var title="">pointer</var> is the node after the node that used to
-       be after <var title="">pointer</var>.</li>
+     <li><p>End the <a href=#synchronous-section>synchronous section</a>, continuing the
+     remaining steps asynchronously.</li>
 
-       <li><p>If <var title="">candidate</var> is null, restart these
-       substeps from the first substep.</li>
+     <li><p>Run the <a href=#concept-media-load-resource title=concept-media-load-resource>resource
+     fetch algorithm</a> with <var title="">absolute URL</var>. If
+     that algorithm returns without aborting <em>this</em> one, then
+     the load failed.</li>
 
-       <li><p><a href=#resolve-a-url title="resolve a url">Resolve</a> the
-       <a href=#url>URL</a> given by the <var title="">candidate</var>
-       element's <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute
-       relative to <var title="">candidate</var>.</li>
+     <li><p><i title="">Failed</i>: <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 <var title="">candidate</var> element.</li>
 
-      </ol><p>Wait for the task to run. When the task ends, if <var title="">candidate</var> is null, then jump to the step below
-      labeled <i>waiting</i>. Otherwise, continue with the next
-      step.</p>
+     <li><p>Asynchronously <a href=#await-a-stable-state>await a stable state</a>. The
+     <a href=#synchronous-section>synchronous section</a> consists of all the remaining
+     steps of this algorithm until the algorithm says the
+     <a href=#synchronous-section>synchronous section</a> has ended. (Steps in <a href=#synchronous-section title="synchronous section">synchronous sections</a> are
+     marked with ⌛.)</li>
 
-     </li>
+     <li><p>⌛ <i title="">Find next candidate</i>: Let <var title="">candidate</var> be null.</li>
 
-     <li>
+     <li><p>⌛ <i title="">Search loop</i>: If the node after
+     <var title="">pointer</var> is the end of the list, then jump o
+     the <i title="">waiting</i> step below.</li>
 
-      <p>If any of the following conditions are true, then <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 <var title="">candidate</var> element and then jump back to the step
-      labelled <i>search loop</i>:</p>
+     <li><p>⌛ If the node after <var title="">pointer</var> is
+     a <code><a href=#the-source-element>source</a></code> element, let <var title="">candidate</var>
+     be that element.</li>
 
-      <ul><li>The <var title="">candidate</var> element does not have a
-       <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute.</li>
+     <li><p>⌛ Advance <var title="">pointer</var> so that the
+     node before <var title="">pointer</var> is now the node that was
+     after <var title="">pointer</var>, and the node after <var title="">pointer</var> is the node after the node that used to be
+     after <var title="">pointer</var>, if any.</li>
 
-       <li><a href=#resolve-a-url title="resolve a url">Resolving</a> the
-       <a href=#url>URL</a> given by the <var title="">candidate</var>
-       element's <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute
-       relative to <var title="">candidate</var> failed.</li>
+     <li><p>⌛ If <var title="">candidate</var> is null, jump
+     back to the <i title="">search loop</i> step. Otherwise, jump
+     back to the <i title="">process candidate</i> step.</li>
 
-       <li>The <var title="">candidate</var> element has a <code title=attr-source-type><a href=#attr-source-type>type</a></code> attribute whose value,
-       when parsed as a MIME type (including any codecs described by
-       the <code title="">codec</code> parameter), represents <a href=#a-type-that-the-user-agent-knows-it-cannot-render>a
-       type that the user agent knows it cannot render</a>.</li>
+     <li><p>⌛ <i title="">Waiting</i>: Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
+     the <a href=#dom-media-network_no_source title=dom-media-NETWORK_NO_SOURCE>NETWORK_NO_SOURCE</a>
+     value.</li>
 
-       <li>The <var title="">candidate</var> element has a <code title=attr-source-media><a href=#attr-source-media>media</a></code> attribute whose value,
-       when processed according to the rules for <a href=#mq>media
-       queries</a>, does not match the current environment. <a href=#refsMQ>[MQ]</a></li>
+     <li><p>⌛ Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
+     flag</a> to false. This stops <a href=#delay-the-load-event title="delay the load
+     event">delaying the load event</a>.</li>
 
-      </ul></li>
+     <li><p>End the <a href=#synchronous-section>synchronous section</a>, continuing the
+     remaining steps asynchronously.</li>
 
-     <li><p>Set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code> again,
-     in case it was set to <code title=dom-media-NETWORK_NO_SOURCE><a href=#dom-media-network_no_source>NETWORK_NO_SOURCE</a></code>
-     above.</li>
-
-     <li><p>Run the <a href=#concept-media-load-resource title=concept-media-load-resource>resource fetch
-     algorithm</a> with the <a href=#absolute-url>absolute URL</a> that resulted
-     from <a href=#resolve-a-url title="resolve a url">resolving</a> the
-     <a href=#url>URL</a> given by the <var title="">candidate</var>
-     element's <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute
-     relative to <var title="">candidate</var>. If that algorithm
-     returns without aborting <em>this</em> one, then the load
-     failed.</li>
-
-     <li><p><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
-     <var title="">candidate</var> element.</li>
-
-     <li><p>Return to the step labeled <i>search loop</i>.</li>
-
-     <li><p><i>Waiting</i>: Set the element's <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> attribute to
-     the <a href=#dom-media-network_no_source title=dom-media-NETWORK_NO_SOURCE>NETWORK_NO_SOURCE</a>
-     value</li>
-
-     <li><p>Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event flag</a>
-     to false. This stops <a href=#delay-the-load-event title="delay the load event">delaying
-     the load event</a>.</li>
-
      <li><p>Wait until the node after <var title="">pointer</var> is a
      node other than the end of the list. (This step might wait
      forever.)</li>
 
-     <li><p>Before the <a href=#concept-task title=concept-task>task</a> that
-     inserted the <code><a href=#the-source-element>source</a></code> element has a chance to
-     complete, set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
-     flag</a> back to true. This <a href=#delay-the-load-event title="delay the load
+     <li><p>Asynchronously <a href=#await-a-stable-state>await a stable state</a>. The
+     <a href=#synchronous-section>synchronous section</a> consists of all the remaining
+     steps of this algorithm until the algorithm says the
+     <a href=#synchronous-section>synchronous section</a> has ended. (Steps in <a href=#synchronous-section title="synchronous section">synchronous sections</a> are
+     marked with ⌛.)</li>
+
+     <li><p>⌛ Set the element's <a href=#delaying-the-load-event-flag>delaying-the-load-event
+     flag</a> back to true (this <a href=#delay-the-load-event title="delay the load
      event">delays the load event</a> again, in case it hasn't been
-     fired yet.</li>
+     fired yet).</p>
 
-     <li><p>Jump back to the step labeled <i>search loop</i>.</li>
+     <li><p>⌛ Set the <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> back to <code title=dom-media-NETWORK_LOADING><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</li>
 
+     <li><p>⌛ Jump back to the <i title="">find next
+     candidate</i> step above.</li>
+
     </ol></li>
 
   </ol><p>The <dfn id=concept-media-load-resource title=concept-media-load-resource>resource fetch
@@ -47304,6 +47302,17 @@
 
    <li><p>Remove that task from its <a href=#task-queue>task queue</a>.</li>
 
+   <li><p>If any asynchronously-running algorithms are <dfn id=await-a-stable-state title="await a stable state">awaiting a stable state</dfn>, then
+   run their <dfn id=synchronous-section>synchronous section</dfn> and then resume running
+   their asynchronous algorithm.</p>
+
+   <p class=note>A <a href=#synchronous-section>synchronous section</a> never mutates
+   the DOM, runs any script, or have any other side-effects.</p>
+
+   <p class=note>Steps in <a href=#synchronous-section title="synchronous
+   section">synchronous sections</a> are marked with
+   ⌛.</li>
+
    <li><p>If necessary, update the rendering or user interface of any
    <code>Document</code> or <a href=#browsing-context>browsing context</a> to reflect
    the current state.</li>

Modified: source
===================================================================
--- source	2009-07-24 20:16:24 UTC (rev 3461)
+++ source	2009-07-26 03:05:46 UTC (rev 3462)
@@ -21667,6 +21667,15 @@
 
   <div class="impl">
 
+  <p>If a <code>source</code> element is inserted as a child of a
+  <span>media element</span> that is <span>in a
+  <code>Document</code></span> and whose <code
+  title="dom-media-networkState">networkState</code> has the value
+  <code title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code>, the user
+  agent must invoke the <span>media element</span>'s <span
+  title="concept-media-load-algorithm">resource selection
+  algorithm</span>.</p>
+
   <p>The DOM attributes <dfn
   title="dom-source-src"><code>src</code></dfn>, <dfn
   title="dom-source-type"><code>type</code></dfn>, and <dfn
@@ -21912,6 +21921,15 @@
 
   <div class="impl">
 
+  <p>If a <code title="attr-media-src">src</code> attribute of a
+  <span>media element</span> that is <span>in a
+  <code>Document</code></span> and whose <code
+  title="dom-media-networkState">networkState</code> has the value
+  <code title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code> is set or
+  changed, the user agent must invoke the <span>media element</span>'s
+  <span title="concept-media-load-algorithm">resource selection
+  algorithm</span>.</p>
+
   <p>The <dfn title="dom-media-src"><code>src</code></dfn> DOM
   attribute on <span title="media element">media elements</span> must
   <span>reflect</span> the respective content attribute of the same
@@ -22254,102 +22272,80 @@
 
   <ol>
 
-   <li>
+   <li><p>Set the <code
+   title="dom-media-networkState">networkState</code> to <code
+   title="dom-media-NETWORK_NO_SOURCE">NETWORK_NO_SOURCE</code>.</p></li>
 
-    <p>If the <span>media element</span> has neither a <code
-    title="attr-media-src">src</code> attribute nor any
-    <code>source</code> element children, run these substeps:</p>
+   <li><p>Asynchronously <span>await a stable state</span>, allowing
+   the <span title="concept-task">task</span> that invoked this
+   algorithm to continue. The <span>synchronous section</span>
+   consists of all the remaining steps of this algorithm until the
+   algorithm says the <span>synchronous section</span> has
+   ended. (Steps in <span title="synchronous section">synchronous
+   sections</span> are marked with &#x231B;.)</p></li>
 
-    <ol>
+   <li>
 
-     <li><p>Set the <code
-     title="dom-media-networkState">networkState</code> to <code
-     title="dom-media-NETWORK_NO_SOURCE">NETWORK_NO_SOURCE</code>.</p></li>
+    <p>&#x231B; If the <span>media element</span> has a <code
+    title="attr-media-src">src</code> attribute, then let <var
+    title="">mode</var> be <i title="">attribute</i>.</p>
 
-     <li><p>Run the remainder of the <span
-     title="concept-media-load-algorithm">resource selection
-     algorithm</span> steps asynchronously, allowing the <span
-     title="concept-task">task</span> that invoked this algorithm to
-     continue.</p></li>
+    <p>&#x231B; Otherwise, if the <span>media element</span> does not
+    have a <code title="attr-media-src">src</code> attribute but has a
+    <code>source</code> element child, then let <var
+    title="">mode</var> be <i title="">children</i> and let <var
+    title="">candidate</var> be the first such <code>source</code>
+    element child in <span>tree order</span>.</p>
 
-     <li><p>While the <span>media element</span> has neither a <code
-     title="attr-media-src">src</code> attribute nor any
-     <code>source</code> element children, wait. (This step might wait
-     forever.)</p></li>
+    <p>&#x231B; Otherwise the <span>media element</span> has neither a
+    <code title="attr-media-src">src</code> attribute nor a
+    <code>source</code> element child: set the <code
+    title="dom-media-networkState">networkState</code> to <code
+    title="dom-media-NETWORK_EMPTY">NETWORK_EMPTY</code>, and abort
+    these steps; the <span>synchronous section</span> ends.</p>
 
-     <li><p>Before the <span title="concept-task">task</span> that set
-     the <code title="attr-media-src">src</code> attribute or inserted
-     the <code>source</code> element has a chance to complete, set the
-     <span>media element</span>'s <span>delaying-the-load-event
-     flag</span> to true (this <span title="delay the load
-     event">delays the load event</span>), and set its <code
-     title="dom-media-networkState">networkState</code> to <code
-     title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code>.</p></li>
-
-     <li><p>If a <code title="attr-media-src">src</code> attribute was
-     set before a <code>source</code> element was inserted, let <var
-     title="">src</var> equal the first value that was assigned to the
-     <code title="attr-media-src">src</code> attribute after this
-     algorithm was invoked.</p></li>
-
-    </ol>
-
-    <p>Otherwise, run these substeps:</p>
-
-    <ol>
-
-     <li><p>Set the <span>media element</span>'s
-     <span>delaying-the-load-event flag</span> to true (this <span
-     title="delay the load event">delays the load event</span>), and
-     set its <code title="dom-media-networkState">networkState</code>
-     to <code
-     title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code>.</p></li>
-
-     <li><p>If the <span>media element</span> has a <code
-     title="attr-media-src">src</code> attribute, let <var
-     title="">src</var> equal the value of that attribute.</p></li>
-
-     <li><p>Run the remainder of the <span
-     title="concept-media-load-algorithm">resource selection
-     algorithm</span> steps asynchronously, allowing the <span
-     title="concept-task">task</span> that invoked this algorithm to
-     continue.</p></li>
-
-    </ol>
-
    </li>
 
-   <li><p class="note">By this point, the algorithm is running
-   asynchronously.</p></li>
+   <li><p>&#x231B; Set the <span>media element</span>'s
+   <span>delaying-the-load-event flag</span> to true (this <span
+   title="delay the load event">delays the load event</span>), and set
+   its <code title="dom-media-networkState">networkState</code> to
+   <code
+   title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code>.</p></li>
 
-   <li><p><span>Queue a task</span> to <span>fire a progress
+   <li><p>&#x231B; <span>Queue a task</span> to <span>fire a progress
    event</span> called <code title="event-loadstart">loadstart</code>
    at the <span>media element</span>.</p></li>
 
    <li>
 
-    <p>If <var title="">src</var> was given a value in the earlier
-    steps, then run these substeps:</p>
+    <p>If <var title="">mode</var> is <i title="">attribute</i>, then
+    run these substeps:</p>
 
     <ol>
 
-     <li><p>Let <var title="">absolute URL</var> be the <span>absolute
-     URL</span> that would have resulted from <span title="resolve a
-     url">resolving</span> the <span>URL</span> given by <var
-     title="">src</var> relative to the <span>media element</span>
-     when the <code title="attr-media-src">src</code> attribute was
-     set to <var title="">src</var>.</p> <!-- i.e. changing xml:base
-     or <base> after src="" has no effect -->
+     <li><p>&#x231B; Let <var title="">absolute URL</var> be the
+     <span>absolute URL</span> that would have resulted from <span
+     title="resolve a url">resolving</span> the <span>URL</span>
+     specified by the <code title="attr-media-src">src</code>
+     attribute's value relative to the <span>media element</span> when
+     the <code title="attr-media-src">src</code> attribute was last
+     changed.</p> <!-- i.e. changing xml:base or <base> after src=""
+     has no effect -->
 
-     <li><p>If <var title="">absolute URL</var> was successfully
-     obtained, then run the <span
+     <li><p>End the <span>synchronous section</span>, continuing the
+     remaining steps asynchronously.</p></li>
+
+     <li><p>If <var title="">absolute URL</var> was obtained
+     successfully, run the <span
      title="concept-media-load-resource">resource fetch
      algorithm</span> with <var title="">absolute URL</var>. If that
      algorithm returns without aborting <em>this</em> one, then the
      load failed.</p></li>
 
-     <li><p>Reaching this step indicates that either the URL failed to
-     resolve, or the media resource failed to load. Set the <code
+     <li><p>Reaching this step indicates that the media resource
+     failed to load or that the given <span>URL</span> could not be
+     <span title="resolve a url">resolved</span>. Set the <code
      title="dom-media-error">error</code> attribute to a new
      <code>MediaError</code> object whose <code
      title="dom-MediaError-code">code</code> attribute is set to <code
@@ -22383,17 +22379,17 @@
 
      <li>
 
-      <p>Let <var title="">pointer</var> be a position defined by two
-      adjacent nodes in the <span>media element</span>'s child list,
-      treating the start of the list (before the first child in the
-      list, if any) and end of the list (after the last child in the
-      list, if any) as nodes in their own right. One node is the node
-      before <var title="">pointer</var>, and the other node is the
-      node after <var title="">pointer</var>. Initially, let <var
-      title="">pointer</var> be the position between the start of the
-      list and the next node (either the first child node of the
-      <span>media element</span>, if there are any, or the end of the
-      list, if it is empty).</p>
+      <p>&#x231B; Let <var title="">pointer</var> be a position
+      defined by two adjacent nodes in the <span>media
+      element</span>'s child list, treating the start of the list
+      (before the first child in the list, if any) and end of the list
+      (after the last child in the list, if any) as nodes in their own
+      right. One node is the node before <var title="">pointer</var>,
+      and the other node is the node after <var
+      title="">pointer</var>. Initially, let <var
+      title="">pointer</var> be the position between the <var
+      title="">candidate</var> node and the next node, if there are
+      any, or the end of the list, if it is the last node.</p>
 
       <p>As elements are inserted and removed into the <span>media
       element</span>, <var title="">pointer</var> must be updated as
@@ -22431,126 +22427,120 @@
 
      </li>
 
-     <li>
+     <li><p>&#x231B; <i>Process candidate</i>: If <var
+     title="">candidate</var> does not have a <code
+     title="attr-source-src">src</code> attribute, then end the
+     <span>synchronous section</span>, and jump down to the <i
+     title="">failed</i> step below.</p></li>
 
-      <p><i>Search loop</i>: <span>Queue a task</span> to run the
-      following steps (so that no other tasks are running that could
-      make the DOM change while these steps are running):</p>
+     <li><p>&#x231B; Let <var title="">absolute URL</var> be the
+     <span>absolute URL</span> that would have resulted from <span
+     title="resolve a url">resolving</span> the <span>URL</span>
+     specified by <var title="">candidate</var>'s <code
+     title="attr-source-src">src</code> attribute's value relative to
+     the <var title="">candidate</var> when the <code
+     title="attr-source-src">src</code> attribute was last
+     changed.</p> <!-- i.e. changing xml:base or <base> after src=""
+     has no effect -->
 
-      <ol>
+     <li><p>&#x231B; If <var title="">absolute URL</var> was not
+     obtained successfully, then end the <span>synchronous
+     section</span>, and jump down to the <i title="">failed</i> step
+     below.</p></li>
 
-       <li><p>Let <var title="">candidate</var> be null.</p></li>
+     <li><p>&#x231B; If <var title="">candidate</var> has a <code
+     title="attr-source-type">type</code> attribute whose value, when
+     parsed as a MIME type (including any codecs described by the
+     <code title="">codec</code> parameter), represents <span>a type
+     that the user agent knows it cannot render</span>, then end the
+     <span>synchronous section</span>, and jump down to the <i
+     title="">failed</i> step below.</p></li>
 
-       <li><p>If the node after <var title="">pointer</var> is the end
-       of the list, then abort the task.</p></li>
+     <li><p>&#x231B; If <var title="">candidate</var> has a <code
+     title="attr-source-media">media</code> attribute whose value,
+     when processed according to the rules for <a href="#mq">media
+     queries</a>, does not match the current environment, then end the
+     <span>synchronous section</span>, and jump down to the <i
+     title="">failed</i> step below. <a
+     href="#refsMQ">[MQ]</a></p></li>
 
-       <li><p>If the node after <var title="">pointer</var> is a
-       <code>source</code> element, let <var title="">candidate</var>
-       be that element.</p></li>
+     <li><p>End the <span>synchronous section</span>, continuing the
+     remaining steps asynchronously.</p></li>
 
-       <li><p>Advance <var title="">pointer</var> so that the node
-       before <var title="">pointer</var> is now the node that was
-       after <var title="">pointer</var>, and the node after <var
-       title="">pointer</var> is the node after the node that used to
-       be after <var title="">pointer</var>.</p></li>
+     <li><p>Run the <span title="concept-media-load-resource">resource
+     fetch algorithm</span> with <var title="">absolute URL</var>. If
+     that algorithm returns without aborting <em>this</em> one, then
+     the load failed.</p></li>
 
-       <li><p>If <var title="">candidate</var> is null, restart these
-       substeps from the first substep.</p></li>
+     <li><p><i title="">Failed</i>: <span>Queue a task</span> to
+     <span>fire a simple event</span> called <code
+     title="event-error">error</code> at the <var
+     title="">candidate</var> element.</p></li>
 
-       <li><p><span title="resolve a url">Resolve</span> the
-       <span>URL</span> given by the <var title="">candidate</var>
-       element's <code title="attr-source-src">src</code> attribute
-       relative to <var title="">candidate</var>.</p></li>
+     <li><p>Asynchronously <span>await a stable state</span>. The
+     <span>synchronous section</span> consists of all the remaining
+     steps of this algorithm until the algorithm says the
+     <span>synchronous section</span> has ended. (Steps in <span
+     title="synchronous section">synchronous sections</span> are
+     marked with &#x231B;.)</p></li>
 
-      </ol>
+     <li><p>&#x231B; <i title="">Find next candidate</i>: Let <var
+     title="">candidate</var> be null.</p></li>
 
-      <p>Wait for the task to run. When the task ends, if <var
-      title="">candidate</var> is null, then jump to the step below
-      labeled <i>waiting</i>. Otherwise, continue with the next
-      step.</p>
+     <li><p>&#x231B; <i title="">Search loop</i>: If the node after
+     <var title="">pointer</var> is the end of the list, then jump o
+     the <i title="">waiting</i> step below.</p></li>
 
-     </li>
+     <li><p>&#x231B; If the node after <var title="">pointer</var> is
+     a <code>source</code> element, let <var title="">candidate</var>
+     be that element.</p></li>
 
-     <li>
+     <li><p>&#x231B; Advance <var title="">pointer</var> so that the
+     node before <var title="">pointer</var> is now the node that was
+     after <var title="">pointer</var>, and the node after <var
+     title="">pointer</var> is the node after the node that used to be
+     after <var title="">pointer</var>, if any.</p></li>
 
-      <p>If any of the following conditions are true, then <span>queue
-      a task</span> to <span>fire a simple event</span> called <code
-      title="event-error">error</code> at the <var
-      title="">candidate</var> element and then jump back to the step
-      labelled <i>search loop</i>:</p>
+     <li><p>&#x231B; If <var title="">candidate</var> is null, jump
+     back to the <i title="">search loop</i> step. Otherwise, jump
+     back to the <i title="">process candidate</i> step.</p></li>
 
-      <ul>
-
-       <li>The <var title="">candidate</var> element does not have a
-       <code title="attr-source-src">src</code> attribute.</li>
-
-       <li><span title="resolve a url">Resolving</span> the
-       <span>URL</span> given by the <var title="">candidate</var>
-       element's <code title="attr-source-src">src</code> attribute
-       relative to <var title="">candidate</var> failed.</li>
-
-       <li>The <var title="">candidate</var> element has a <code
-       title="attr-source-type">type</code> attribute whose value,
-       when parsed as a MIME type (including any codecs described by
-       the <code title="">codec</code> parameter), represents <span>a
-       type that the user agent knows it cannot render</span>.</li>
-
-       <li>The <var title="">candidate</var> element has a <code
-       title="attr-source-media">media</code> attribute whose value,
-       when processed according to the rules for <a href="#mq">media
-       queries</a>, does not match the current environment. <a
-       href="#refsMQ">[MQ]</a></li>
-
-      </ul>
-
-     </li>
-
-     <li><p>Set the <code
-     title="dom-media-networkState">networkState</code> to <code
-     title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code> again,
-     in case it was set to <code
-     title="dom-media-NETWORK_NO_SOURCE">NETWORK_NO_SOURCE</code>
-     above.</p></li>
-
-     <li><p>Run the <span
-     title="concept-media-load-resource">resource fetch
-     algorithm</span> with the <span>absolute URL</span> that resulted
-     from <span title="resolve a url">resolving</span> the
-     <span>URL</span> given by the <var title="">candidate</var>
-     element's <code title="attr-source-src">src</code> attribute
-     relative to <var title="">candidate</var>. If that algorithm
-     returns without aborting <em>this</em> one, then the load
-     failed.</p></li>
-
-     <li><p><span>Queue a task</span> to <span>fire a simple
-     event</span> called <code title="event-error">error</code> at the
-     <var title="">candidate</var> element.</p></li>
-
-     <li><p>Return to the step labeled <i>search loop</i>.</p></li>
-
-     <li><p><i>Waiting</i>: Set the element's <code
+     <li><p>&#x231B; <i title="">Waiting</i>: Set the element's <code
      title="dom-media-networkState">networkState</code> attribute to
      the <span
      title="dom-media-NETWORK_NO_SOURCE">NETWORK_NO_SOURCE</span>
-     value</p></li>
+     value.</p></li>
 
-     <li><p>Set the element's <span>delaying-the-load-event flag</span>
-     to false. This stops <span title="delay the load event">delaying
-     the load event</span>.</p></li>
+     <li><p>&#x231B; Set the element's <span>delaying-the-load-event
+     flag</span> to false. This stops <span title="delay the load
+     event">delaying the load event</span>.</p></li>
 
+     <li><p>End the <span>synchronous section</span>, continuing the
+     remaining steps asynchronously.</p></li>
+
      <li><p>Wait until the node after <var title="">pointer</var> is a
      node other than the end of the list. (This step might wait
      forever.)</p></li>
 
-     <li><p>Before the <span title="concept-task">task</span> that
-     inserted the <code>source</code> element has a chance to
-     complete, set the element's <span>delaying-the-load-event
-     flag</span> back to true. This <span title="delay the load
+     <li><p>Asynchronously <span>await a stable state</span>. The
+     <span>synchronous section</span> consists of all the remaining
+     steps of this algorithm until the algorithm says the
+     <span>synchronous section</span> has ended. (Steps in <span
+     title="synchronous section">synchronous sections</span> are
+     marked with &#x231B;.)</p></li>
+
+     <li><p>&#x231B; Set the element's <span>delaying-the-load-event
+     flag</span> back to true (this <span title="delay the load
      event">delays the load event</span> again, in case it hasn't been
-     fired yet.</p></li>
+     fired yet).</p>
 
-     <li><p>Jump back to the step labeled <i>search loop</i>.</p></li>
+     <li><p>&#x231B; Set the <code
+     title="dom-media-networkState">networkState</code> back to <code
+     title="dom-media-NETWORK_LOADING">NETWORK_LOADING</code>.</p></li>
 
+     <li><p>&#x231B; Jump back to the <i title="">find next
+     candidate</i> step above.</p></li>
+
     </ol>
 
    </li>
@@ -53771,6 +53761,18 @@
 
    <li><p>Remove that task from its <span>task queue</span>.</p></li>
 
+   <li><p>If any asynchronously-running algorithms are <dfn
+   title="await a stable state">awaiting a stable state</dfn>, then
+   run their <dfn>synchronous section</dfn> and then resume running
+   their asynchronous algorithm.</p>
+
+   <p class="note">A <span>synchronous section</span> never mutates
+   the DOM, runs any script, or have any other side-effects.</p>
+
+   <p class="note">Steps in <span title="synchronous
+   section">synchronous sections</span> are marked with
+   &#x231B;.</p></li>
+
    <li><p>If necessary, update the rendering or user interface of any
    <code>Document</code> or <span>browsing context</span> to reflect
    the current state.</p></li>




More information about the Commit-Watchers mailing list