HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
2074Define event loops, task queues, etc; Make 'fetching' use this mechanism (everything will in due course); Fix some cross-references around 'interactive content'.2008-08-16 00:52
@@ -3437,35 +3437,50 @@
 
    <li><p>If the resource is identified by a <span>URL</span>, then
    immediately <span title="resolve a URL">resolve that
    URL</span>.</p></li>
 
    <li><p>If the resulting <span>absolute URL</span> is
    <dfn><code>about:blank</code></dfn>, then return the empty string
    and abort these steps.</p></li>
 
    <li><p>Perform the remaining steps asynchronously.</p></li>
-   <!-- XXX queue interaction -->
-
-   <li><p>If the resource identified by the resulting <span>absolute
-   URL</span> is already being downloaded for other reasons
-   (e.g. another invocation of this algorithm), then the results of
-   that existing download process may be used for the purposes of this
-   one, in which case the following step must be skipped.</p></li>
-
-   <li><p>At a time convenient to the user and the user agent,
-   download the resource, applying the semantics of the relevant
-   specifications (e.g. performing an HTTP GET or POST operation, or
-   reading the file from disk, following redirects, <span
-   title="concept-js-deref">dereferencing <span title="javascript
-   protocol"><code title="">javascript:</code> URLs</span></span>,
-   etc).</p></li>
+
+   <li>
+
+    <p>If the resource identified by the resulting <span>absolute
+    URL</span> is already being downloaded for other reasons
+    (e.g. another invocation of this algorithm), and the resource is
+    to be obtained using a idempotent action (such as an HTTP GET or
+    equivalent), and the user agent is configured such that it is to
+    reuse the data from the existing download instead of initiating a
+    new one, then use the results of the existing download instead of
+    starting a new one.</p>
+
+    <p>Otherwise, at a time convenient to the user and the user agent,
+    download the resource, applying the semantics of the relevant
+    specifications (e.g. performing an HTTP GET or POST operation, or
+    reading the file from disk, following redirects, <span
+    title="concept-js-deref">dereferencing <span title="javascript
+    protocol"><code title="">javascript:</code> URLs</span></span>,
+    etc).</p>
+
+   </li>
+
+   <li><p>When the resource is available, <span>queue a task</span>
+   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 <span>task source</span>
+   for these tasks is the <dfn>networking task source</dfn>.</p>
+   <!-- XXX make sure each use of 'fetch' defines what the appropriate
+   task is -->
 
   </ol>
 
   <p class="note">The <span>offline application cache</span>
   processing model introduces some <a
   href="#changesToNetworkingModel">changes to the networking model</a>
   to handle the returning of cached resources.</p>
 
   <p class="note">The <span title="navigate">navigation</span>
   processing model handles redirects itself, overriding the
@@ -6405,22 +6420,20 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0
   title="dom-click">click()</code> method can be used to make it
   happen programmatically.</p>
 
   <p>For certain form controls, this process is complicated further by
   <a
   href="http://www.whatwg.org/specs/web-forms/current-work/#the-click">changes
   that must happen around the click event</a>. <a
   href="#refsWF2">[WF2]</a></p> <!-- XXX WF2: when this is merged into
   this spec, update xrefs -->
 
-  <p class="note">Most interactive elements have content models that
-  disallow nesting interactive elements.</p>
 
 
   <h4>Transparent content models</h4>
 
   <p>Some elements are described as <dfn>transparent</dfn>; they have
   "transparent" as their content model. Some elements are described as
   <dfn>semi-transparent</dfn>; this means that part of their content
   model is "transparent" but that is not the only part of the content
   model that must be satisfied.</p>
 
@@ -10808,21 +10821,21 @@ first matching case):&lt;/p&gt;
    hyperlinks">follow the hyperlink</span> defined by the
    <code>a</code> element. If the steps above defined a <var>hyperlink
    suffix</var>, then take that into account when following the
    hyperlink.</p></li>
 
   </ol>
 
   <p class="note">One way that a user agent can enable users to follow
   hyperlinks is by allowing <code>a</code> elements to be clicked, or
   focussed and activated by the keyboard. This <span
-  title="interactive elements">will cause</span> the aforementioned
+  title="interactive content">will cause</span> the aforementioned
   <span>activation behavior</span> to be invoked.</p>
 
   <p>The DOM attributes <dfn
   title="dom-a-href"><code>href</code></dfn>, <dfn
   title="dom-a-ping"><code>ping</code></dfn>, <dfn
   title="dom-a-target"><code>target</code></dfn>, <dfn
   title="dom-a-rel"><code>rel</code></dfn>, <dfn
   title="dom-a-media"><code>media</code></dfn>, <dfn
   title="dom-a-hreflang"><code>hreflang</code></dfn>, and <dfn
   title="dom-a-type"><code>type</code></dfn>, must each
@@ -10831,21 +10844,21 @@ first matching case):&lt;/p&gt;
 
   <p>The DOM attribute <dfn
   title="dom-a-rellist"><code>relList</code></dfn> must
   <span>reflect</span> the <code title="attr-hyperlink-rel">rel</code>
   content attribute.</p>
 
   <div class="example">
 
    <p>The <code>a</code> element may be wrapped around entire
    paragraphs, lists, tables, and so forth, even entire sections, so
-   long as there are no interactive elements within (e.g. buttons or
+   long as there is no interactive content within (e.g. buttons or
    other links). This example shows how this can be used to make an
    entire advertising block into a link:</p>
 
    <pre>&lt;aside class="advertising">
  &lt;h1>Advertising&lt;/h1>
  &lt;a href="http://ad.example.com/?adid=1929&amp;amp;pubid=1422">
   &lt;section>
    &lt;h1>Mellblomatic 9000!&lt;/h1>
    &lt;p>Turn all your widgets into mellbloms!&lt;/p>
    &lt;p>Only $9.99 plus shipping and handling.&lt;/p>
@@ -15791,21 +15804,20 @@ href="?audio">audio&lt;/a> test instead.)&lt;/p></pre>
   height</span> of the video resource, if that is available; otherwise
   it is the intrinsic height of the <span>poster frame</span>, if that
   is available; otherwise it is 150 CSS pixels.</p>
 
   <p class="note">The <span>poster frame</span> is not affected by the
   pixel ratio conversions.</p>
 
   <hr>
 
   <!-- XXX
-   make it an interactive element
    default activation behavior is to do the play() if paused, pause()
    otherwise
   -->
 
   <p>User agents should provide controls to enable or disable the
   display of closed captions associated with the video stream, though
   such features should, again, not interfere with the page's normal
   rendering.</p>
 
   <p>User agents may allow users to view the video content in manners
@@ -21106,21 +21118,21 @@ function AddCloud(data, x, y) { ... }</pre>
 
    <li>Otherwise, the user agent must <span title="following
    hyperlinks">follow the hyperlink</span> defined by the
    <code>area</code> element, if any.</li>
 
   </ol>
 
   <p class="note">One way that a user agent can enable users to follow
   hyperlinks is by allowing <code>area</code> elements to be clicked,
   or focussed and activated by the keyboard. This <span
-  title="interactive elements">will cause</span> the aforementioned
+  title="interactive content">will cause</span> the aforementioned
   <span>activation behavior</span> to be invoked.</p>
 
   <p>The DOM attributes <dfn
   title="dom-area-alt"><code>alt</code></dfn>, <dfn
   title="dom-area-coords"><code>coords</code></dfn>, <dfn
   title="dom-area-href"><code>href</code></dfn>, <dfn
   title="dom-area-target"><code>target</code></dfn>, <dfn
   title="dom-area-ping"><code>ping</code></dfn>, <dfn
   title="dom-area-rel"><code>rel</code></dfn>, <dfn
   title="dom-area-media"><code>media</code></dfn>, <dfn
@@ -24528,21 +24540,21 @@ https://www.google.com/base/settings
   do, the DOM not reflecting state has been a pain in the neck
   before. But is it semantically ok?</p>
 
 
 
   <h4 id="datagrid">The <dfn><code>datagrid</code></dfn> element</h4>
 
   <dl class="element">
    <dt>Categories</dt>
    <dd><span>Flow content</span>.</dd>
-   <dd><span>Interactive element</span>.</dd>
+   <dd><span>Interactive content</span>.</dd>
    <dd><span>Sectioning root</span>.</dd>
    <dt>Contexts in which this element may be used:</dt>
    <dd>Where <span>flow content</span> is expected.</dd>
    <dt>Content model:</dt>
    <dd>Either: Nothing.</dd>
    <dd>Or: <span>Flow content</span>, but where the first element child node, if any, is not a <code>table</code>, <code>select</code>, or <code>datalist</code> element.</dd>
    <dd>Or: A single <code>table</code> element.</dd>
    <dd>Or: A single <code>select</code> element.</dd>
    <dd>Or: A single <code>datalist</code> element.</dd>
    <dt>Element-specific attributes:</dt>
@@ -28884,21 +28896,21 @@ never reset. This is nice and consistent.)
   context</span> <var title="">b</var>, on getting, must run the
   following algorithm:</p>
 
   <ol>
 
    <li><p>If <var title="">b</var> is not a <span>child browsing
    context</span>, return null and abort these steps.</p></li>
 
    <li><p>If the <span>parent browsing context</span>'s <span>active
    document</span> does not have the <span>same</span> <span>effective
-   origin</span> as the script that is accessing the <code
+   script origin</span> as the script that is accessing the <code
    title="dom-frameElement">frameElement</code> attribute, then throw
    a <span>security exception</span>.</p></li>
 
    <li><p>Otherwise, return the <span>browsing context
    container</span> for <var title="">b</var>.</p></li>
 
   </ol>
 
 
 
@@ -28994,20 +29006,29 @@ never reset. This is nice and consistent.)
    <li>The <span>browsing context</span>'s <span>opener browsing
    context</span>.</li>
 
   </ul>
 
   <p>The transitive closure of all the <span title="browsing
   context">browsing contexts</span> that are <span>directly reachable
   browsing contexts</span> forms a <dfn>unit of related browsing
   contexts</dfn>.</p>
 
+  <p>Each <span>unit of related browsing contexts</span> is then
+  further divided into the smallest number of groups such that every
+  member of each group has an <span>effective script origin</span>
+  that, through appropriate manipulation of the <code
+  title="dom-document-domain">document.domain</code> attribute, could
+  be made to be the same as other members of the group, but could not
+  be made the same as members of any other group. Each such group is a
+  <dfn>unit of related similar-origin browsing contexts</dfn>.</p>
+
 
 
   <h4>Browsing context names</h4>
 
   <p>Browsing contexts can have a <dfn>browsing context name</dfn>. By
   default, a browsing context has no name (its name is not set).</p>
 
   <p>A <dfn>valid browsing context name</dfn> is any string with at
   least one character that does not start with a U+005F LOW LINE
   character. (Names starting with an underscore are reserved for
@@ -29962,21 +29983,113 @@ never reset. This is nice and consistent.)
 
   <p class="note">Thus, for instance, enabling <code
   title="dom-document-designMode">designMode</code> will disable any
   event handler attributes, event listeners, timeouts, etc, that were
   set by scripts in the document.</p>
 
 
 
   <h4>Event loops</h4>
 
-  <p class="big-issue">...</p><!-- XXXqueue-->
+  <p>To coordinate events, user interaction, scripts, rendering,
+  networking, and so forth, user agents must use <dfn title="event
+  loop">event loops</dfn> as described in this section.</p>
+
+  <p>There must be at least one <span>event loop</span> per user
+  agent, and at most one <span>event loop</span> per <span>unit of
+  related similar-origin browsing contexts</span>.</p>
+
+  <p>An <span>event loop</span> always has at least one <span>browsing
+  context</span>. If an <span>event loop</span>'s <span
+  title="browsing context">browsing contexts</span> all go away, then
+  the <span>event loop</span> goes away as well. A <span>browsing
+  context</span> always has an <span>event loop</span> coordinating
+  its activities.</p>
+
+  <p>An <span>event loop</span> has one or more <dfn title="task
+  queue">task queues</dfn>. A <span>task queue</span> is an ordered
+  list of:</p>
+
+  <dl>
+
+   <dt>Events</dt>
+
+   <dd>
+
+    <p>Asynchronously dispatching an <code>Event</code> object at a
+    particular <code>EventTarget</code> object is a task.</p>
+
+    <p class="note">Not all events are dispatched using the <span>task
+    queue</span>, many are dispatched synchronously during other
+    tasks.</p>
+
+   </dd>
+
+
+   <dt>Parsing</dt>
+
+   <dd><p>The <span>HTML parser</span> tokenising a single byte, and
+   then processing any resulting tokens, is a task.</p></dd>
+
+
+   <dt>Callbacks</dt>
+
+   <dd><p>Calling a callback asynchronously is a task.</p></dd>
+
+
+   <dt>Using a resource</dt>
+
+   <dd><p>When an algorithm <span title="fetch">fetches</span> a
+   resource, if the fetching occurs asynchronously then the processing
+   of the resource once some or all of the resource is available is a
+   task.</p></dd>
+
+  </dl>
+
+  <p>When a user agent is to <dfn>queue a task</dfn>, it must add the
+  given task to one of the <span title="task queue">task queues</span>
+  of the relevant <span>event loop</span>. All the tasks from one
+  particular <dfn>task source</dfn> (e.g. the callbacks generated by
+  timers, the events dispatched for mouse movements, the tasks queued
+  for the parser) must always be added to the same <span>task
+  queue</span>, but tasks from different <span title="task
+  source">task sources</span> may be placed in different <span
+  title="task queue">task queues</span>.</p>
+
+  <p class="example">For example, a user agent could have one
+  <span>task queue</span> for mouse and key events (the <span>user
+  interaction task source</span><!-- XXX xref -->), and another for
+  everything else. The user agent could then give keyboard and mouse
+  events preference over other tasks three quarters of the time,
+  keeping the interface responsive but not starving other task queues,
+  and never processing events from any one <span>task source</span>
+  out of order.</p>
+
+  <p>An <span>event loop</span> must continually run through the
+  following steps for as long as it exists:</p>
+
+  <ol>
+
+   <li><p>Run the oldest task on one of the <span>event loop</span>'s
+   <span title="task queue">task queues</span>. The user agent may
+   pick any <span>task queue</span>.</p></li>
+
+   <li><p>Remove that task from its <span>task queue</span>.</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>
+
+   <li><p>Return to the first step of the <span>event
+   loop</span>.</p></li>
+
+  </ol>
 
 
 
   <h4>Security exceptions</h4>
 
   <p class="big-issue">Define <dfn>security exception</dfn>.</p>
 
 
 
   <!-- SCRIPT EXEC -->

|