hixie: Tweak the algorithm for <img> loading to avoid multiple network requests when src='' is set multiple times in a row. (whatwg r6780)

hixie: Tweak the algorithm for <img> loading to avoid multiple network
requests when src='' is set multiple times in a row. (whatwg r6780)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.5428&r2=1.5429&f=h
http://html5.org/tools/web-apps-tracker?from=6779&to=6780

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.5428
retrieving revision 1.5429
diff -u -d -r1.5428 -r1.5429
--- Overview.html 28 Oct 2011 22:49:09 -0000 1.5428
+++ Overview.html 28 Oct 2011 22:59:44 -0000 1.5429
@@ -18508,15 +18508,39 @@
    <li><p>If the user agent cannot support images, or its support for
    images has been disabled, then abort these steps.</li>
 
-   <li><p>If the element's <code title="attr-img-src"><a href="#attr-img-src">src</a></code>
-   attribute's value is the empty string, then set the element to the
-   <a href="#img-error" title="img-error">broken</a> state, <a href="#queue-a-task">queue a
-   task</a> to <a href="#fire-a-simple-event">fire a simple event</a> named <code title="event-error">error</code> at the <code><a href="#the-img-element">img</a></code> element,
-   and abort these steps.</li>
+   <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 &#8987;.)</li>
 
    <li>
 
-    <p><a href="#resolve-a-url" title="resolve a url">Resolve</a> the value
+    <p>&#8987; If another instance of this algorithm for this
+    <code><a href="#the-img-element">img</a></code> element was started after this instance, then
+    abort these steps. Only the last instance takes effect, to avoid
+    multiple requests when the <code title="attr-img-src"><a href="#attr-img-src">src</a></code>
+    attribute is set multiple times in a row, or when the <code title="attr-img-src"><a href="#attr-img-src">src</a></code> and <code title="attr-img-crossorigin"><a href="#attr-img-crossorigin">crossorigin</a></code> attributes are
+    both set in succession.</p>
+
+   </li>
+
+   <li>
+
+    <p>&#8987; If the element's <code title="attr-img-src"><a href="#attr-img-src">src</a></code>
+    attribute is missing or its value is the empty string, then set
+    the element to the <a href="#img-error" title="img-error">broken</a> state,
+    <a href="#queue-a-task">queue a task</a> to <a href="#fire-a-simple-event">fire a simple event</a>
+    named <code title="event-error">error</code> at the
+    <code><a href="#the-img-element">img</a></code> element, and abort these steps.</p>
+
+   </li>
+
+   <li>
+
+    <p>&#8987; <a href="#resolve-a-url" title="resolve a url">Resolve</a> the value
     of the element's <code title="attr-img-src"><a href="#attr-img-src">src</a></code> attribute,
     relative to the element.</p>
 
@@ -18524,8 +18548,8 @@
 
     <p>Otherwise, do a <a href="#potentially-cors-enabled-fetch">potentially CORS-enabled fetch</a> of
     the resulting <a href="#absolute-url">absolute URL</a>, with the <i>mode</i>
-    being the state of the element's <code title="attr-img-crossorigin"><a href="#attr-img-crossorigin">crossorigin</a></code> content
-    attribute, the <i title="">origin</i> being the <a href="#origin">origin</a> of the
+    being the state of the element's <code title="attr-img-crossorigin"><a href="#attr-img-crossorigin">crossorigin</a></code> content attribute,
+    the <i title="">origin</i> being the <a href="#origin">origin</a> of the
     <code><a href="#the-img-element">img</a></code> element's <code><a href="#document">Document</a></code>, and the
     <i>default origin behaviour</i> set to <i>taint</i>.</p>

Received on Friday, 28 October 2011 23:00:03 UTC