microdata; hixie: Fix the handling of infinite loops in the various microdata algorithms. (whatwg r6277)

microdata; hixie: Fix the handling of infinite loops in the various
microdata algorithms. (whatwg r6277)

http://dev.w3.org/cvsweb/html5/md/Overview.html?r1=1.137&r2=1.138&f=h
http://html5.org/tools/web-apps-tracker?from=6276&to=6277

===================================================================
RCS file: /sources/public/html5/md/Overview.html,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -d -r1.137 -r1.138
--- Overview.html 14 Jun 2011 21:56:16 -0000 1.137
+++ Overview.html 7 Jul 2011 21:14:28 -0000 1.138
@@ -318,7 +318,7 @@
 
    <h1>HTML Microdata</h1>
    <h2 class="no-num no-toc" id="generatedID"></h2>
-   <h2 class="no-num no-toc" id="editor-s-draft-14-june-2011">Editor's Draft 14 June 2011</h2>
+   <h2 class="no-num no-toc" id="editor-s-draft-7-july-2011">Editor's Draft 7 July 2011</h2>
    <dl><dt>Latest Published Version:</dt>
     <dd><a href="http://www.w3.org/TR/microdata/">http://www.w3.org/TR/microdata/</a></dd>
     <dt>Latest Editor's Draft:</dt>
@@ -338,7 +338,7 @@
    </dl><p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
    &copy; 2011 <a href="http://www.w3.org/"><abbr title="World Wide
    Web Consortium">W3C</abbr></a><sup>&reg;</sup> (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts
-   Institute of Technology">MIT</abbr></a>, <a href="http://www.ercim.org/"><abbr title="European Research
+   Institute of Technology">MIT</abbr></a>, <a href="http://www.ercim.eu/"><abbr title="European Research
    Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C
    <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
    <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
@@ -359,10 +359,12 @@
   model. It is compatible with numerous other data formats including
   RDF and JSON.<h2 class="no-num no-toc" id="status-of-this-document">Status of This document</h2><p><em>This section describes the status of this document at the
   time of its publication. Other documents may supersede this
-  document. A list of current W3C publications and the most recently
-  formally published revision of this technical report can be found in
-  the <a href="http://www.w3.org/TR/">W3C technical reports index</a>
-  at http://www.w3.org/TR/.</em></p><p>If you wish to make comments regarding this document in a manner
+  document. A list of current W3C publications and the
+
+  most recently formally published <!-- DO NOT CHANGE THIS BACK TO THE STANDARD BOILERPLATE, AS IT IS INACCURATE -->
+
+  revision of this technical report can be found in the <a href="http://www.w3.org/TR/">W3C technical reports index</a> at
+  http://www.w3.org/TR/.</em></p><p>If you wish to make comments regarding this document in a manner
   that is tracked by the W3C, please submit them via using <a href="http://www.w3.org/Bugs/Public/enter_bug.cgi?product=HTML%20WG">our
   public bug database</a>. If you do not have an account then you can
   enter feedback using this form:<form action="http://www.whatwg.org/specs/web-apps/current-work/file-spam.cgi" method="post">
@@ -442,8 +444,6 @@
   HTML specifications:<dl><dt>E-mail notifications of changes</dt>
    <dd>HTML-Diffs mailing list (diff-marked HTML versions for each change): <a href="http://lists.w3.org/Archives/Public/public-html-diffs/latest">http://lists.w3.org/Archives/Public/public-html-diffs/latest</a></dd>
    <dd>Commit-Watchers mailing list (complete source diffs): <a href="http://lists.whatwg.org/listinfo.cgi/commit-watchers-whatwg.org">http://lists.whatwg.org/listinfo.cgi/commit-watchers-whatwg.org</a></dd>
-   <dt>Real-time notifications of changes:</dt>
-   <dd>Generated diff-marked HTML versions for each change: <a href="http://twitter.com/HTML5">http://twitter.com/HTML5</a></dd>
    <dt>Browsable version-control record of all changes:</dt>
    <dd>CVSWeb interface with side-by-side diffs: <a href="http://dev.w3.org/cvsweb/html5/">http://dev.w3.org/cvsweb/html5/</a></dd>
    <dd>Annotated summary with unified diffs: <a href="http://html5.org/tools/web-apps-tracker">http://html5.org/tools/web-apps-tracker</a></dd>
@@ -452,7 +452,7 @@
   Group</a> is the W3C working group responsible for this
   specification's progress along the W3C Recommendation
   track.
-  This specification is the 14 June 2011 Editor's Draft.
+  This specification is the 7 July 2011 Editor's Draft.
   </p><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><p>Work on this specification is also done at the <a href="http://www.whatwg.org/">WHATWG</a>. The W3C HTML working group
   actively pursues convergence with the WHATWG, as required by the <a href="http://www.w3.org/2007/03/HTML-WG-charter">W3C HTML working
   group charter</a>.</p><!-- UNDER NO CIRCUMSTANCES IS THE FOLLOWING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><p>This specification is an extension to the HTML5 language. All
@@ -1075,7 +1075,13 @@
   unique space-separated tokens</a> that are
   <span>case-sensitive</span>, consisting of <a href="#concept-id" title="concept-ID">IDs</a> of elements in the same <a href="#home-subtree">home
   subtree</a>.<p>The <code title="attr-itemref"><a href="#attr-itemref">itemref</a></code> attribute must not
-  be specified on elements that do not have an <code title="attr-itemscope"><a href="#attr-itemscope">itemscope</a></code> attribute specified.<h3 id="names:-the-itemprop-attribute"><span class="secno">2.3 </span>Names: the <dfn title="attr-itemprop"><code>itemprop</code></dfn> attribute</h3><p>Every <a href="#html-elements" title="HTML elements">HTML element</a> may have an
+  be specified on elements that do not have an <code title="attr-itemscope"><a href="#attr-itemscope">itemscope</a></code> attribute specified.<p class="note">The <code title="attr-itemref"><a href="#attr-itemref">itemref</a></code>
+  attribute is not part of the microdata data model. It is merely a
+  syntactic construct to aid authors in adding annotations to pages
+  where the data to be annotated does not follow a convenient tree
+  structure. For example, it allows authors to mark up data in a table
+  so that each column defines a separate <a href="#concept-item" title="concept-item">item</a>, while keeping the properties in
+  the cells.<h3 id="names:-the-itemprop-attribute"><span class="secno">2.3 </span>Names: the <dfn title="attr-itemprop"><code>itemprop</code></dfn> attribute</h3><p>Every <a href="#html-elements" title="HTML elements">HTML element</a> may have an
   <code title="attr-itemprop"><a href="#names:-the-itemprop-attribute">itemprop</a></code> attribute specified, if
   doing so <a href="#the-properties-of-an-item" title="the properties of an item">adds a
   property</a> to one or more <a href="#concept-item" title="concept-item">items</a> (as defined below).<p>The <code title="attr-itemprop"><a href="#names:-the-itemprop-attribute">itemprop</a></code> attribute, if
@@ -1218,46 +1224,13 @@
   represents a <a href="#concept-date" title="concept-date">date</a>, <a href="#concept-time" title="concept-time">time</a>, or <a href="#concept-datetime" title="concept-datetime">global date and time</a>, the property
   must be specified using the <code title="attr-time-datetime">datetime</code> attribute of a
   <code>time</code> element.<h3 id="associating-names-with-items"><span class="secno">2.5 </span>Associating names with items</h3><p>To find <dfn id="the-properties-of-an-item">the properties of an item</dfn> defined by the
-  element <var title="">root</var>, the user agent must try to
-  <a href="#crawl-the-properties">crawl the properties</a> of the element <var title="">root</var>, with an empty list as the value of <var title="">memory</var>: if this fails, then <a href="#the-properties-of-an-item" title="the
-  properties of an item">the properties of the item</a> defined by
-  the element <var title="">root</var> is an empty list; otherwise, it
-  is the returned list.<p>To <dfn id="crawl-the-properties">crawl the properties</dfn> of an element <var title="">root</var> with a list <var title="">memory</var>, the user
-  agent must run the following steps. These steps either fail or
-  return a list with a count of errors. The count of errors is used as
-  part of the authoring conformance criteria below.<ol><li><p>If <var title="">root</var> is in <var title="">memory</var>, then the algorithm fails; abort these
-   steps.</li>
-
-   <li><p><a href="#collect-all-the-elements-in-the-item">Collect all the elements in the item</a> <var title="">root</var>; let <var title="">results</var> be the
-   resulting list of elements, and <var title="">errors</var> be the
-   resulting count of errors.</li>
-
-   <li><p>Remove any elements from <var title="">results</var> that do
-   not have an <code title="attr-itemprop"><a href="#names:-the-itemprop-attribute">itemprop</a></code> attribute
-   specified.</li>
-
-   <li><p>Let <var title="">new memory</var> be a new list consisting
-   of the old list <var title="">memory</var> with the addition of
-   <var title="">root</var>.</li>
-
-   <li><p>For each element in <var title="">results</var> that has an
-   <code title="attr-itemscope"><a href="#attr-itemscope">itemscope</a></code> attribute specified,
-   <a href="#crawl-the-properties">crawl the properties</a> of the element, with <var title="">new memory</var> as the memory. If this fails, then remove
-   the element from <var title="">results</var> and increment <var title="">errors</var>. (If it succeeds, the return value is
-   discarded.)</li>
-
-   <li><p>Sort <var title="">results</var> in <a href="#tree-order">tree
-   order</a>.</li>
-
-   <li><p>Return <var title="">results</var> and <var title="">errors</var>.</li>
-
-  </ol><p>To <dfn id="collect-all-the-elements-in-the-item">collect all the elements in the item</dfn> <var title="">root</var>, the user agent must run these steps. They
-  return a list of elements and a count of errors.<ol><li><p>Let <var title="">results</var> and <var title="">pending</var> be empty lists of elements.</li>
+  element <var title="">root</var>, the user agent must run the
+  following steps. These steps are also used to flag <a href="#microdata-error" title="microdata error">microdata errors</a>.<ol><li><p>Let <var title="">results</var>, <var title="">memory</var>, and <var title="">pending</var> be empty lists of elements.</li>
 
-   <li><p>Let <var title="">errors</var> be zero.</li>
+   <li><p>Add the element <var title="">root</var> to <var title="">memory</var>.</li>
 
-   <li><p>Add all the children elements of <var title="">root</var> to
-   <var title="">pending</var>.</li>
+   <li><p>Add the child elements of <var title="">root</var>, if any,
+   to <var title="">pending</var>.</li>
 
    <li><p>If <var title="">root</var> has an <code title="attr-itemref"><a href="#attr-itemref">itemref</a></code> attribute, <a href="#split-a-string-on-spaces" title="split a
    string on spaces">split the value of that <code title="attr-itemref">itemref</code> attribute on spaces</a>. For
@@ -1266,40 +1239,48 @@
    the <a href="#concept-id" title="concept-ID">ID</a> <var title="">ID</var>, then
    add the first such element to <var title="">pending</var>.</li>
 
-   <li><p><i>Loop</i>: Remove an element from <var title="">pending</var> and let <var title="">current</var> be that
-   element.</li>
+   <li><p><i>Loop</i>: If <var title="">pending</var> is empty, jump
+   to the step labeled <i>end of loop</i>.</li>
 
-   <li><p>If <var title="">current</var> is already in <var title="">results</var>, increment <var title="">errors</var>.</li>
+   <li><p>Remove an element from <var title="">pending</var> and let
+   <var title="">current</var> be that element.</li>
 
-   <li><p>If <var title="">current</var> is not already in <var title="">results</var> and <var title="">current</var> does not
+   <li><p>If <var title="">current</var> is already in <var title="">memory</var>, there is a <a href="#microdata-error">microdata error</a>;
+   return to the step labeled <i>loop</i>.</li>
+
+   <li><p>Add <var title="">current</var> to <var title="">memory</var>.</li>
+
+   <li><p>If <var title="">current</var> does not
    have an <code title="attr-itemscope"><a href="#attr-itemscope">itemscope</a></code> attribute,
    then: add all the child elements of <var title="">current</var> to
    <var title="">pending</var>.</li>
 
-   <li><p>If <var title="">current</var> is not already in <var title="">results</var>, then: add <var title="">current</var> to
-   <var title="">results</var>.</li>
+   <li><p>If <var title="">current</var> has an <code title="attr-itemprop"><a href="#names:-the-itemprop-attribute">itemprop</a></code> attribute specified, add it
+   to <var title="">results</var>.</li>
 
-   <li><p><i>End of loop</i>: If <var title="">pending</var> is not
-   empty, return to the step labeled <i>loop</i>.</li>
+   <li><p>Return to the step labeled <i>loop</i>.</li>
 
-   <li><p>Return <var title="">results</var> and <var title="">errors</var>.</li>
+   <li><p><i>End of loop</i>: Sort <var title="">results</var> in
+   <a href="#tree-order">tree order</a>.</li>
 
-  </ol><p>An <a href="#concept-item" title="concept-item">item</a> is a <dfn id="top-level-microdata-items" title="top-level microdata items">top-level microdata item</dfn> if
+   <li><p>Return <var title="">results</var>.</li>
+
+  </ol><p>A document must not contain any <a href="#concept-item" title="concept-item">items</a> for which the algorithm to find
+  <a href="#the-properties-of-an-item">the properties of an item</a> finds any <dfn id="microdata-error" title="microdata error">microdata errors</dfn>.<p>An <a href="#concept-item" title="concept-item">item</a> is a <dfn id="top-level-microdata-items" title="top-level microdata items">top-level microdata item</dfn> if
   its element does not have an <code title="attr-itemprop"><a href="#names:-the-itemprop-attribute">itemprop</a></code> attribute.<p>An <a href="#concept-item" title="concept-item">item</a> is a <dfn id="used-microdata-items" title="used
   microdata items">used microdata item</dfn> if it is a <a href="#top-level-microdata-items" title="top-level microdata items">top-level microdata item</a>,
   or if it has an <code title="attr-itemprop"><a href="#names:-the-itemprop-attribute">itemprop</a></code>
   attribute and would be <a href="#the-properties-of-an-item" title="the properties of an item">found
   to be the property</a> of an <a href="#concept-item" title="concept-item">item</a> that is itself a <a href="#used-microdata-items" title="used
   microdata items">used microdata item</a>.<p>All <a href="#concept-item" title="concept-item">items</a> in a document must be
-  <a href="#used-microdata-items">used microdata items</a>.<p>A document must not contain any elements that have an <code title="attr-itemprop"><a href="#names:-the-itemprop-attribute">itemprop</a></code> attribute that would not be
+  <a href="#used-microdata-items">used microdata items</a>.<p>All <code title="attr-itemref"><a href="#attr-itemref">itemref</a></code> attributes in a
+  <code>Document</code> must be such that there are no cycles in the
+  graph formed from representing each <a href="#concept-item" title="concept-item">item</a> in the <code>Document</code> as a
+  node in the graph and each <a href="#the-properties-of-an-item" title="the properties of an
+  item">property</a> of an item whose <a href="#concept-property-value" title="concept-property-value">value</a> is another item as an
+  edge in the graph connecting those two items.<p>A document must not contain any elements that have an <code title="attr-itemprop"><a href="#names:-the-itemprop-attribute">itemprop</a></code> attribute that would not be
   found to be a property of any of the <a href="#concept-item" title="concept-item">items</a> in that document were their <a href="#the-properties-of-an-item" title="the properties of an item">properties</a> all to be
-  determined.<p>A document must not contain any <a href="#concept-item" title="concept-item">items</a> for which <a href="#crawl-the-properties" title="crawl the
-  properties">crawling the properties</a> of the element, with an
-  empty list as the value of <var title="">memory</var>, either fails
-  or returns an error count other than zero.<p class="note">The algorithms in this section are especially
-  inefficient, in the interests of keeping them easy to
-  understand. Implementors are strongly encouraged to refactor and
-  optimize them in their user agents.<div class="example">
+  determined.<div class="example">
 
    <p>In this example, a single license statement is applied to two
    works, using <code title="attr-itemref"><a href="#attr-itemref">itemref</a></code> from the
@@ -1552,10 +1533,12 @@
    to JSON.</li>
 
   </ol><p>When the user agent is to <dfn id="get-the-object">get the object</dfn> for an item
-  <var title="">item</var>, it must run the following substeps:</p>
+  <var title="">item</var>, optionally with a list of elements <var title="">memory</var>, it must run the following substeps:</p>
 
   <ol><li><p>Let <var title="">result</var> be an empty object.</li>
 
+   <li><p>Add <var title="">item</var> to <var title="">memory</var>.</li>
+
    <li><p>If the <var title="">item</var> has an <a href="#item-type">item
    type</a>, add an entry to <var title="">result</var> called
    "<code title="">type</code>" whose value is the <a href="#item-type">item
@@ -1579,10 +1562,10 @@
 
     <ol><li><p>Let <var title="">value</var> be the <a href="#concept-property-value" title="concept-property-value">property value</a> of <var title="">element</var>.</li>
 
-     <li><p>If <var title="">value</var> is an <a href="#concept-item" title="concept-item">item</a>, then <a href="#get-the-object">get the
-     object</a> for <var title="">value</var>, and then replace
-     <var title="">value</var> with the object returned from those
-     steps.</li>
+     <li><p>If <var title="">value</var> is an <a href="#concept-item" title="concept-item">item</a>, then: If <var title="">value</var> is in <var title="">memory</var>, then let
+     <var title="">value</var> be the string "<code title="">ERROR</code>". Otherwise, <a href="#get-the-object">get the object</a>
+     for <var title="">value</var>, passing a copy of <var title="">memory</var>, and then replace <var title="">value</var>
+     with the object returned from those steps.</li>
 
      <li>
 
@@ -1745,15 +1728,18 @@
   <var title="">fallback name</var>, it must run the following
   steps:</p>
 
-  <ol><li><p>If there is an entry for <var title="">item</var> in <var title="">memory</var>, then let <var title="">subject</var> be the
-   subject of that entry. Otherwise, if <var title="">item</var> has a
-   <a href="#global-identifier">global identifier</a> and that <a href="#global-identifier">global
-   identifier</a> is an <a href="#absolute-url">absolute URL</a>, let <var title="">subject</var> be that <a href="#global-identifier">global
-   identifier</a>. Otherwise, let <var title="">subject</var> be a
-   new blank node.</li>
+  <ol><li><p>If there is an entry for the item <var title="">item</var>
+   in <var title="">memory</var>, then return the subject of that
+   entry and abort these steps.</li>
 
-   <li><p>Add a mapping from <var title="">item</var> to <var title="">subject</var> in <var title="">memory</var>, if there
-   isn't one already.</li>
+   <li><p>If <var title="">item</var> has a <a href="#global-identifier">global
+   identifier</a> and that <a href="#global-identifier">global identifier</a> is an
+   <a href="#absolute-url">absolute URL</a>, let <var title="">subject</var> be that
+   <a href="#global-identifier">global identifier</a>. Otherwise, let <var title="">subject</var> be a new blank node.</li>
+
+   <li><p>Add a mapping from the item <var title="">item</var> to the
+   subject <var title="">subject</var> in <var title="">memory</var>,
+   if there isn't one already.</li>
 
    <li><p>If <var title="">item</var> has an <a href="#item-type">item type</a>
    and that <a href="#item-type">item type</a> is an <a href="#absolute-url">absolute URL</a>,

Received on Thursday, 7 July 2011 21:15:17 UTC