Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[cgiowt] (0) Be less draconian in the error handling for loops in mic…
…rodata. Be clearer about whether %s get double-escaped in the RDF conversion.

git-svn-id: http://svn.whatwg.org/webapps@4980 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Apr 7, 2010
1 parent 8f843c9 commit de4ca4d
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 157 deletions.
88 changes: 38 additions & 50 deletions complete.html
Expand Up @@ -49363,20 +49363,16 @@ <h4 id=associating-names-with-items><span class=secno>5.2.5 </span>Associating n
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>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><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
Expand All @@ -49388,19 +49384,22 @@ <h4 id=associating-names-with-items><span class=secno>5.2.5 </span>Associating n

<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>

Expand All @@ -49414,15 +49413,20 @@ <h4 id=associating-names-with-items><span class=secno>5.2.5 </span>Associating n
<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> 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> 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>
Expand All @@ -49443,7 +49447,8 @@ <h4 id=associating-names-with-items><span class=secno>5.2.5 </span>Associating n

<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
Expand Down Expand Up @@ -49497,31 +49502,6 @@ <h4 id=associating-names-with-items><span class=secno>5.2.5 </span>Associating n
<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>&lt;!-- invalid example - do not copy --&gt;
&lt;div itemscope&gt;
&lt;span itemprop="example"&gt;This is &lt;em&gt;not&lt;/em&gt; a property of the
&lt;code&gt;div&lt;/code&gt; element.&lt;/span&gt;
&lt;p itemprop="demo" itemscope itemref="test thing"&gt; &lt;!-- "thing" is a descendant
of "test", which leads to it being included twice, which is invalid --&gt;
&lt;span itemprop="sample"&gt;This isn't part of anything either.&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;p id="test"&gt;
&lt;span id="thing"&gt;(this element is referenced twice by the
&lt;code&gt;p&lt;/code&gt; above, causing all the items that involve that
&lt;code&gt;itemref=""&lt;/code&gt; attribute to act as if they had no
properties.)&lt;/span&gt;
&lt;/p&gt;</pre>

</div>



<h3 id=microdata-dom-api><span class=secno>5.3 </span>Microdata DOM API</h3>
Expand Down Expand Up @@ -52727,11 +52707,19 @@ <h4 id=json><span class=secno>5.5.1 </span>JSON</h4>
&lt;ifragment&gt; 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 &lt;ifragment&gt;
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 &lt;ifragment&gt;
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>

Expand Down
88 changes: 38 additions & 50 deletions index
Expand Up @@ -49264,20 +49264,16 @@ document.body.appendChild(outer);</pre>
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>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><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
Expand All @@ -49289,19 +49285,22 @@ document.body.appendChild(outer);</pre>

<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>

Expand All @@ -49315,15 +49314,20 @@ document.body.appendChild(outer);</pre>
<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> 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> 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>
Expand All @@ -49344,7 +49348,8 @@ document.body.appendChild(outer);</pre>

<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
Expand Down Expand Up @@ -49398,31 +49403,6 @@ document.body.appendChild(outer);</pre>
<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>&lt;!-- invalid example - do not copy --&gt;
&lt;div itemscope&gt;
&lt;span itemprop="example"&gt;This is &lt;em&gt;not&lt;/em&gt; a property of the
&lt;code&gt;div&lt;/code&gt; element.&lt;/span&gt;
&lt;p itemprop="demo" itemscope itemref="test thing"&gt; &lt;!-- "thing" is a descendant
of "test", which leads to it being included twice, which is invalid --&gt;
&lt;span itemprop="sample"&gt;This isn't part of anything either.&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;p id="test"&gt;
&lt;span id="thing"&gt;(this element is referenced twice by the
&lt;code&gt;p&lt;/code&gt; above, causing all the items that involve that
&lt;code&gt;itemref=""&lt;/code&gt; attribute to act as if they had no
properties.)&lt;/span&gt;
&lt;/p&gt;</pre>

</div>



<h3 id=microdata-dom-api><span class=secno>5.3 </span>Microdata DOM API</h3>
Expand Down Expand Up @@ -52628,11 +52608,19 @@ END:VCARD</pre>
&lt;ifragment&gt; 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 &lt;ifragment&gt;
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 &lt;ifragment&gt;
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>

Expand Down

0 comments on commit de4ca4d

Please sign in to comment.