[html5] r4980 - [cgiowt] (0) Be less draconian in the error handling for loops in microdata. Be [...]

whatwg at whatwg.org whatwg at whatwg.org
Tue Apr 6 17:00:19 PDT 2010


Author: ianh
Date: 2010-04-06 17:00:17 -0700 (Tue, 06 Apr 2010)
New Revision: 4980

Modified:
   complete.html
   index
   source
Log:
[cgiowt] (0) Be less draconian in the error handling for loops in microdata. Be clearer about whether %s get double-escaped in the RDF conversion.

Modified: complete.html
===================================================================
--- complete.html	2010-04-06 09:01:44 UTC (rev 4979)
+++ complete.html	2010-04-07 00:00:17 UTC (rev 4980)
@@ -49363,21 +49363,17 @@
   is the returned list.</p>
 
   <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:</p>
+  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.</p>
 
   <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>, and let <var title="">results</var> be the
-   result.</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>If <var title="">root</var> is in <var title="">results</var>, then the algorithm fails; abort these
-   steps.</li>
-
-   <li><p>If any elements are listed in <var title="">results</var>
-   more than once, then the algorithm fails; abort these
-   steps.</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>
@@ -49388,19 +49384,22 @@
 
    <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 this
-   instance of the algorithm fails as well; abort these steps. (If it
-   succeeds, the return value is discarded.)</li>
+   <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>.</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:</p>
+  </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.</p>
 
   <ol><li><p>Let <var title="">results</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 all the children elements of <var title="">root</var> to
    <var title="">pending</var>.</li>
 
@@ -49414,15 +49413,20 @@
    <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>Add <var title="">current</var> to <var title="">results</var>.</li>
+   <li><p>If <var title="">current</var> is already in <var title="">results</var>, increment <var title="">errors</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> and <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><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 <var title="">results</var>.</li>
+   <li><p>Return <var title="">results</var> and <var title="">errors</var>.</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
   its element does not have an <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute.</p>
@@ -49443,7 +49447,8 @@
 
   <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>, fails.</p>
+  empty list as the value of <var title="">memory</var>, either fails
+  or returns an error count other than zero.</p>
 
   <p class=note>The algorithms in this section are especially
   inefficient, in the interests of keeping them easy to
@@ -49497,33 +49502,8 @@
     <dd><code title="">http://www.opensource.org/licenses/mit-license.php</code>
    </dl></div>
 
-  <div class=example>
 
-   <p>In the following invalid example, the items are all empty,
-   because the <code title=attr-itemref><a href=#attr-itemref>itemref</a></code> attribute on
-   the inner nested item indirectly references the same element twice
-   in the same item:</p>
 
-   <pre class=bad><!-- invalid example - do not copy -->
-<div itemscope>
- <span itemprop="example">This is <em>not</em> a property of the
- <code>div</code> element.</span>
- <p itemprop="demo" itemscope itemref="test thing"> <!-- "thing" is a descendant
-                   of "test", which leads to it being included twice, which is invalid -->
-  <span itemprop="sample">This isn't part of anything either.</span>
- </p>
-</div>
-<p id="test">
- <span id="thing">(this element is referenced twice by the
- <code>p</code> above, causing all the items that involve that
- <code>itemref=""</code> attribute to act as if they had no
- properties.)</span>
-</p></pre>
-
-  </div>
-
-
-
   <h3 id=microdata-dom-api><span class=secno>5.3 </span>Microdata DOM API</h3>
 
 
@@ -52727,12 +52707,20 @@
            <ifragment> production of the IRI syntax being
            %-escaped. <a href=#refsRFC3987>[RFC3987]</a></li>
 
-           <li><p>Let <var title="">predicate</var> be the
-           concatenation of the string "<code title="">http://www.w3.org/1999/xhtml/microdata#</code>"
-           and <var title="">s</var>, with any characters in <var title="">s</var> that are not valid in the <ifragment>
-           production of the IRI syntax being %-escaped. <a href=#refsRFC3987>[RFC3987]</a></li> <!-- this ensures
-           you can't use a URL to get the same effect -->
+           <li>
 
+            <p>Let <var title="">predicate</var> be the concatenation
+            of the string "<code title="">http://www.w3.org/1999/xhtml/microdata#</code>"
+            and <var title="">s</var>, with any characters in <var title="">s</var> that are not valid in the <ifragment>
+            production of the IRI syntax being %-escaped, but without
+            double-escaping existing %-escapes. <a href=#refsRFC3987>[RFC3987]</a></p> <!-- this ensures
+            you can't use a URL to get the same effect -->
+
+            <p class=example>For example if the string <var title="">s</var> is "<code title="">http://example.com/a#:q%20r</code>", the
+            resulting <var title="">predicate</var> would be "<code title="">http://www.w3.org/1999/xhtml/microdata#http://example.com/a%23:q%20r</code>".</p>
+
+           </li>
+
           </ol></dd>
 
         </dl></li>

Modified: index
===================================================================
--- index	2010-04-06 09:01:44 UTC (rev 4979)
+++ index	2010-04-07 00:00:17 UTC (rev 4980)
@@ -49264,21 +49264,17 @@
   is the returned list.</p>
 
   <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:</p>
+  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.</p>
 
   <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>, and let <var title="">results</var> be the
-   result.</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>If <var title="">root</var> is in <var title="">results</var>, then the algorithm fails; abort these
-   steps.</li>
-
-   <li><p>If any elements are listed in <var title="">results</var>
-   more than once, then the algorithm fails; abort these
-   steps.</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>
@@ -49289,19 +49285,22 @@
 
    <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 this
-   instance of the algorithm fails as well; abort these steps. (If it
-   succeeds, the return value is discarded.)</li>
+   <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>.</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:</p>
+  </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.</p>
 
   <ol><li><p>Let <var title="">results</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 all the children elements of <var title="">root</var> to
    <var title="">pending</var>.</li>
 
@@ -49315,15 +49314,20 @@
    <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>Add <var title="">current</var> to <var title="">results</var>.</li>
+   <li><p>If <var title="">current</var> is already in <var title="">results</var>, increment <var title="">errors</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> and <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><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 <var title="">results</var>.</li>
+   <li><p>Return <var title="">results</var> and <var title="">errors</var>.</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
   its element does not have an <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute.</p>
@@ -49344,7 +49348,8 @@
 
   <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>, fails.</p>
+  empty list as the value of <var title="">memory</var>, either fails
+  or returns an error count other than zero.</p>
 
   <p class=note>The algorithms in this section are especially
   inefficient, in the interests of keeping them easy to
@@ -49398,33 +49403,8 @@
     <dd><code title="">http://www.opensource.org/licenses/mit-license.php</code>
    </dl></div>
 
-  <div class=example>
 
-   <p>In the following invalid example, the items are all empty,
-   because the <code title=attr-itemref><a href=#attr-itemref>itemref</a></code> attribute on
-   the inner nested item indirectly references the same element twice
-   in the same item:</p>
 
-   <pre class=bad><!-- invalid example - do not copy -->
-<div itemscope>
- <span itemprop="example">This is <em>not</em> a property of the
- <code>div</code> element.</span>
- <p itemprop="demo" itemscope itemref="test thing"> <!-- "thing" is a descendant
-                   of "test", which leads to it being included twice, which is invalid -->
-  <span itemprop="sample">This isn't part of anything either.</span>
- </p>
-</div>
-<p id="test">
- <span id="thing">(this element is referenced twice by the
- <code>p</code> above, causing all the items that involve that
- <code>itemref=""</code> attribute to act as if they had no
- properties.)</span>
-</p></pre>
-
-  </div>
-
-
-
   <h3 id=microdata-dom-api><span class=secno>5.3 </span>Microdata DOM API</h3>
 
 
@@ -52628,12 +52608,20 @@
            <ifragment> production of the IRI syntax being
            %-escaped. <a href=#refsRFC3987>[RFC3987]</a></li>
 
-           <li><p>Let <var title="">predicate</var> be the
-           concatenation of the string "<code title="">http://www.w3.org/1999/xhtml/microdata#</code>"
-           and <var title="">s</var>, with any characters in <var title="">s</var> that are not valid in the <ifragment>
-           production of the IRI syntax being %-escaped. <a href=#refsRFC3987>[RFC3987]</a></li> <!-- this ensures
-           you can't use a URL to get the same effect -->
+           <li>
 
+            <p>Let <var title="">predicate</var> be the concatenation
+            of the string "<code title="">http://www.w3.org/1999/xhtml/microdata#</code>"
+            and <var title="">s</var>, with any characters in <var title="">s</var> that are not valid in the <ifragment>
+            production of the IRI syntax being %-escaped, but without
+            double-escaping existing %-escapes. <a href=#refsRFC3987>[RFC3987]</a></p> <!-- this ensures
+            you can't use a URL to get the same effect -->
+
+            <p class=example>For example if the string <var title="">s</var> is "<code title="">http://example.com/a#:q%20r</code>", the
+            resulting <var title="">predicate</var> would be "<code title="">http://www.w3.org/1999/xhtml/microdata#http://example.com/a%23:q%20r</code>".</p>
+
+           </li>
+
           </ol></dd>
 
         </dl></li>

Modified: source
===================================================================
--- source	2010-04-06 09:01:44 UTC (rev 4979)
+++ source	2010-04-07 00:00:17 UTC (rev 4980)
@@ -55004,7 +55004,9 @@
 
   <p>To <dfn>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:</p>
+  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.</p>
 
   <ol>
 
@@ -55013,17 +55015,10 @@
    steps.</p></li>
 
    <li><p><span>Collect all the elements in the item</span> <var
-   title="">root</var>, and let <var title="">results</var> be the
-   result.</p></li>
+   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.</p></li>
 
-   <li><p>If <var title="">root</var> is in <var
-   title="">results</var>, then the algorithm fails; abort these
-   steps.</p></li>
-
-   <li><p>If any elements are listed in <var title="">results</var>
-   more than once, then the algorithm fails; abort these
-   steps.</p></li>
-
    <li><p>Remove any elements from <var title="">results</var> that do
    not have an <code title="attr-itemprop">itemprop</code> attribute
    specified.</p></li>
@@ -55035,25 +55030,30 @@
    <li><p>For each element in <var title="">results</var> that has an
    <code title="attr-itemscope">itemscope</code> attribute specified,
    <span>crawl the properties</span> of the element, with <var
-   title="">new memory</var> as the memory. If this fails, then this
-   instance of the algorithm fails as well; abort these steps. (If it
-   succeeds, the return value is discarded.)</p></li>
+   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.)</p></li>
 
    <li><p>Sort <var title="">results</var> in <span>tree
    order</span>.</p></li>
 
-   <li><p>Return <var title="">results</var>.</p></li>
+   <li><p>Return <var title="">results</var> and <var
+   title="">errors</var>.</p></li>
 
   </ol>
 
   <p>To <dfn>collect all the elements in the item</dfn> <var
-  title="">root</var>, the user agent must run these steps:</p>
+  title="">root</var>, the user agent must run these steps. They
+  return a list of elements and a count of errors.</p>
 
   <ol>
 
    <li><p>Let <var title="">results</var> and <var
    title="">pending</var> be empty lists of elements.</p></li>
 
+   <li><p>Let <var title="">errors</var> be zero.</p></li>
+
    <li><p>Add all the children elements of <var title="">root</var> to
    <var title="">pending</var>.</p></li>
 
@@ -55070,18 +55070,25 @@
    title="">pending</var> and let <var title="">current</var> be that
    element.</p></li>
 
-   <li><p>Add <var title="">current</var> to <var
-   title="">results</var>.</p></li>
+   <li><p>If <var title="">current</var> is already in <var
+   title="">results</var>, increment <var
+   title="">errors</var>.</p></li>
 
-   <li><p>If <var title="">current</var> does not have an <code
-   title="attr-itemscope">itemscope</code> attribute, then: add all
-   the child elements of <var title="">current</var> to <var
-   title="">pending</var>.</p></li>
+   <li><p>If <var title="">current</var> is not already in <var
+   title="">results</var> and <var title="">current</var> does not
+   have an <code title="attr-itemscope">itemscope</code> attribute,
+   then: add all the child elements of <var title="">current</var> to
+   <var title="">pending</var>.</p></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>.</p></li>
+
    <li><p><i>End of loop</i>: If <var title="">pending</var> is not
    empty, return to the step labeled <i>loop</i>.</p></li>
 
-   <li><p>Return <var title="">results</var>.</p></li>
+   <li><p>Return <var title="">results</var> and <var
+   title="">errors</var>.</p></li>
 
   </ol>
 
@@ -55113,7 +55120,8 @@
   <p>A document must not contain any <span
   title="concept-item">items</span> for which <span title="crawl the
   properties">crawling the properties</span> of the element, with an
-  empty list as the value of <var title="">memory</var>, fails.</p>
+  empty list as the value of <var title="">memory</var>, either fails
+  or returns an error count other than zero.</p>
 
   <p class="note">The algorithms in this section are especially
   inefficient, in the interests of keeping them easy to
@@ -55174,33 +55182,8 @@
 
   </div>
 
-  <div class="example">
 
-   <p>In the following invalid example, the items are all empty,
-   because the <code title="attr-itemref">itemref</code> attribute on
-   the inner nested item indirectly references the same element twice
-   in the same item:</p>
 
-   <pre class="bad"><!-- invalid example - do not copy -->
-<div itemscope>
- <span itemprop="example">This is <em>not</em> a property of the
- <code>div</code> element.</span>
- <p itemprop="demo" itemscope itemref="test thing"> <!-- "thing" is a descendant
-                   of "test", which leads to it being included twice, which is invalid -->
-  <span itemprop="sample">This isn't part of anything either.</span>
- </p>
-</div>
-<p id="test">
- <span id="thing">(this element is referenced twice by the
- <code>p</code> above, causing all the items that involve that
- <code>itemref=""</code> attribute to act as if they had no
- properties.)</span>
-</p></pre>
-
-  </div>
-
-
-
   <h3>Microdata DOM API</h3>
 
 <!--END html--><!--END complete-->
@@ -59282,15 +59265,26 @@
            <ifragment> production of the IRI syntax being
            %-escaped. <a href="#refsRFC3987">[RFC3987]</a></p></li>
 
-           <li><p>Let <var title="">predicate</var> be the
-           concatenation of the string "<code
-           title="">http://www.w3.org/1999/xhtml/microdata#</code>"
-           and <var title="">s</var>, with any characters in <var
-           title="">s</var> that are not valid in the <ifragment>
-           production of the IRI syntax being %-escaped. <a
-           href="#refsRFC3987">[RFC3987]</a></p></li> <!-- this ensures
-           you can't use a URL to get the same effect -->
+           <li>
 
+            <p>Let <var title="">predicate</var> be the concatenation
+            of the string "<code
+            title="">http://www.w3.org/1999/xhtml/microdata#</code>"
+            and <var title="">s</var>, with any characters in <var
+            title="">s</var> that are not valid in the <ifragment>
+            production of the IRI syntax being %-escaped, but without
+            double-escaping existing %-escapes. <a
+            href="#refsRFC3987">[RFC3987]</a></p> <!-- this ensures
+            you can't use a URL to get the same effect -->
+
+            <p class="example">For example if the string <var
+            title="">s</var> is "<code
+            title="">http://example.com/a#:q%20r</code>", the
+            resulting <var title="">predicate</var> would be "<code
+            title="">http://www.w3.org/1999/xhtml/microdata#http://example.com/a%23:q%20r</code>".</p>
+
+           </li>
+
           </ol>
 
          </dd>




More information about the Commit-Watchers mailing list