Skip to content

Commit

Permalink
[e] (0) clarify how to generate ifragment thingies
Browse files Browse the repository at this point in the history
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=12341

git-svn-id: http://svn.whatwg.org/webapps@6112 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed May 6, 2011
1 parent 7c2cc79 commit 439a11f
Show file tree
Hide file tree
Showing 3 changed files with 235 additions and 55 deletions.
94 changes: 76 additions & 18 deletions complete.html
Expand Up @@ -374,8 +374,9 @@ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
<li><a href=#terminology-0><span class=secno>2.6.1 </span>Terminology</a></li>
<li><a href=#parsing-urls><span class=secno>2.6.2 </span>Parsing URLs</a></li>
<li><a href=#resolving-urls><span class=secno>2.6.3 </span>Resolving URLs</a></li>
<li><a href=#dynamic-changes-to-base-urls><span class=secno>2.6.4 </span>Dynamic changes to base URLs</a></li>
<li><a href=#interfaces-for-url-manipulation><span class=secno>2.6.5 </span>Interfaces for URL manipulation</a></ol></li>
<li><a href=#url-manipulation-and-creation><span class=secno>2.6.4 </span>URL manipulation and creation</a></li>
<li><a href=#dynamic-changes-to-base-urls><span class=secno>2.6.5 </span>Dynamic changes to base URLs</a></li>
<li><a href=#interfaces-for-url-manipulation><span class=secno>2.6.6 </span>Interfaces for URL manipulation</a></ol></li>
<li><a href=#fetching-resources><span class=secno>2.7 </span>Fetching resources</a>
<ol>
<li><a href=#concept-http-equivalent><span class=secno>2.7.1 </span>Protocol concepts</a></li>
Expand Down Expand Up @@ -6457,7 +6458,70 @@ <h4 id=resolving-urls><span class=secno>2.6.3 </span>Resolving URLs</h4>

<div class=impl>

<h4 id=dynamic-changes-to-base-urls><span class=secno>2.6.4 </span>Dynamic changes to base URLs</h4>
<h4 id=url-manipulation-and-creation><span class=secno>2.6.4 </span>URL manipulation and creation</h4>

<p>To <dfn id=fragment-escaped title=fragment-escaped>fragment-escape</dfn> a string
<var title="">input</var>, a user agent must run the following
steps:</p>

<ol><li><p>Let <var title="">input</var> be the string to be
escaped.</li>

<li><p>Let <var title="">position</var> point at the first
character of <var title="">input</var>.</li>

<li><p>Let <var title="">output</var> be an empty string.</li>

<li><p><i>Loop</i>: If <var title="">position</var> is past the end
of <var title="">input</var>, then jump to the step labeled
<i>end</i>.</li>

<li>

<p>If the character in <var title="">input</var> pointed to by
<var title="">position</var> is in the range U+0000 to U+0020 or
is one of the following characters:</p>

<ul class=brief><li>U+0022 QUOTATION MARK character (")
<li>U+0023 NUMBER SIGN character (#)
<li>U+0025 PERCENT SIGN character (%)
<li>U+003C LESS-THAN SIGN character (&lt;)
<li>U+003E GREATER-THAN SIGN character (&gt;)
<li>U+005B LEFT SQUARE BRACKET character ([)
<li>U+005C REVERSE SOLIDUS character (\)
<li>U+005D RIGHT SQUARE BRACKET character (])
<li>U+005E CIRCUMFLEX ACCENT character (^)
<li>U+007B LEFT CURLY BRACKET character ({)
<li>U+007C VERTICAL LINE character (|)
<li>U+007D RIGHT CURLY BRACKET character (})
</ul><p>...then append the percent-encoded form of the character to
<var title="">output</var>. <a href=#refsRFC3986>[RFC3986]</a></p> <!-- this is the same
phrasing that's used elsewhere in the spec, but we really should
define 'percent-encoded' or at least ensure we consistently say
whether it's upper-case or lower-case. -->

<p>Otherwise, append the character itself to <var title="">output</var>.</p>

<p class=note>This escapes any ASCII characters that are not
valid in the URI &lt;fragment&gt; production without being
escaped.</p>

</li>

<li><p>Advance <var title="">position</var> to the next character
in <var title="">input</var>.</li>

<li><p>Return to the step labeled <i>loop</i>.</li>

<li><p><i>End</i>: Return <var title="">output</var>.</li>

</ol></div>



<div class=impl>

<h4 id=dynamic-changes-to-base-urls><span class=secno>2.6.5 </span>Dynamic changes to base URLs</h4>

<p>When an <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attribute
changes, the attribute's element, and all descendant elements, are
Expand Down Expand Up @@ -6530,7 +6594,7 @@ <h4 id=dynamic-changes-to-base-urls><span class=secno>2.6.4 </span>Dynamic chang



<h4 id=interfaces-for-url-manipulation><span class=secno>2.6.5 </span>Interfaces for URL manipulation</h4>
<h4 id=interfaces-for-url-manipulation><span class=secno>2.6.6 </span>Interfaces for URL manipulation</h4>

<p>An interface that has a complement of <dfn id=url-decomposition-idl-attributes>URL decomposition IDL
attributes</dfn> has seven attributes with the following
Expand Down Expand Up @@ -45322,7 +45386,7 @@ <h6 id=radio-button-state><span class=secno>4.10.7.1.17 </span><dfn title=attr-i
owner</a>.</li>

<li>They both have a <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>
attribute, their code title="attr-fe-name"&gt;name attributes
attribute, their <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attributes
are not empty, and the value of <var title="">a</var>'s <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute is a <a href=#compatibility-caseless>compatibility
caseless</a> match for the value of <var title="">b</var>'s
<code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute.</li>
Expand Down Expand Up @@ -58955,7 +59019,7 @@ <h4 id=json><span class=secno>5.5.1 </span>JSON</h4>
characters (:), generate the following triple:</p>

<dl class=triple><dt>subject <dd> <a href="#the-document's-current-address">the document's current address</a>
<dt>predicate <dd> the concatenation of the string "<code title="">http://www.w3.org/1999/xhtml/vocab#</code>" and <var title="">token</var>, with any characters in <var title="">token</var> that are not valid in the &lt;ifragment&gt; production of the IRI syntax being %-escaped <a href=#refsRFC3987>[RFC3987]</a>
<dt>predicate <dd> the <a href=#fragment-escaped>fragment-escaped</a> concatenation of the string "<code title="">http://www.w3.org/1999/xhtml/vocab#</code>" and <var title="">token</var>
<dt>object <dd> the <a href=#absolute-url>absolute URL</a> that results from <a href=#resolve-a-url title="resolve a URL">resolving</a> the value of the element's <code title="">href</code> attribute relative to the element
</dl><p>For each token <var title="">token</var> in <var title="">list of tokens</var> that is an <a href=#absolute-url>absolute
URL</a>, generate the following triple:</p>
Expand All @@ -58977,7 +59041,7 @@ <h4 id=json><span class=secno>5.5.1 </span>JSON</h4>
triple:</p>

<dl class=triple><dt>subject <dd> <a href="#the-document's-current-address">the document's current address</a>
<dt>predicate <dd> the concatenation of the string "<code title="">http://www.w3.org/1999/xhtml/vocab#</code>" and the value of the element's <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute, <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>, with any characters in the value that are not valid in the &lt;ifragment&gt; production of the IRI syntax being %-escaped <a href=#refsRFC3987>[RFC3987]</a>
<dt>predicate <dd> the <a href=#fragment-escaped>fragment-escaped</a> concatenation of the string "<code title="">http://www.w3.org/1999/xhtml/vocab#</code>" and the value of the element's <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute, <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>
<dt>object <dd> the value of the element's <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute, as a plain literal, with the language information set from the <a href=#language>language</a> of the element, if it is not unknown
</dl><p>For each <code><a href=#the-meta-element>meta</a></code> element in the <code><a href=#document>Document</a></code>
that has a <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute and
Expand Down Expand Up @@ -59109,10 +59173,7 @@ <h4 id=json><span class=secno>5.5.1 </span>JSON</h4>
character (%), a U+0032 DIGIT TWO character (2), and a U+0030
DIGIT ZERO character (0) to <var title="">type</var>.</li>

<li><p>Append the value of <var title="">fallback name</var> to
<var title="">type</var>, with any characters in <var title="">fallback name</var> that are not valid in the
&lt;ifragment&gt; production of the IRI syntax being
%-escaped. <a href=#refsRFC3987>[RFC3987]</a></li>
<li><p>Append the <a href=#fragment-escaped>fragment-escaped</a> value of <var title="">fallback name</var> to <var title="">type</var>.</li>

</ol></li>

Expand Down Expand Up @@ -59170,18 +59231,15 @@ <h4 id=json><span class=secno>5.5.1 </span>JSON</h4>
SIGN character (%), a U+0032 DIGIT TWO character (2), and a
U+0030 DIGIT ZERO character (0) to <var title="">s</var>.</li>

<li><p>Append the value of <var title="">name</var> to <var title="">s</var>, with any characters in <var title="">name</var> that are not valid in the
&lt;ifragment&gt; production of the IRI syntax being
%-escaped. <a href=#refsRFC3987>[RFC3987]</a></li>
<li><p>Append the <a href=#fragment-escaped>fragment-escaped</a> value of
<var title="">name</var> to <var title="">s</var>.</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, 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 -->
and the <a href=#fragment-escaped>fragment-escaped</a> value of <var title="">s</var>.</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>
Expand Down
94 changes: 76 additions & 18 deletions index
Expand Up @@ -382,8 +382,9 @@
<li><a href=#terminology-0><span class=secno>2.6.1 </span>Terminology</a></li>
<li><a href=#parsing-urls><span class=secno>2.6.2 </span>Parsing URLs</a></li>
<li><a href=#resolving-urls><span class=secno>2.6.3 </span>Resolving URLs</a></li>
<li><a href=#dynamic-changes-to-base-urls><span class=secno>2.6.4 </span>Dynamic changes to base URLs</a></li>
<li><a href=#interfaces-for-url-manipulation><span class=secno>2.6.5 </span>Interfaces for URL manipulation</a></ol></li>
<li><a href=#url-manipulation-and-creation><span class=secno>2.6.4 </span>URL manipulation and creation</a></li>
<li><a href=#dynamic-changes-to-base-urls><span class=secno>2.6.5 </span>Dynamic changes to base URLs</a></li>
<li><a href=#interfaces-for-url-manipulation><span class=secno>2.6.6 </span>Interfaces for URL manipulation</a></ol></li>
<li><a href=#fetching-resources><span class=secno>2.7 </span>Fetching resources</a>
<ol>
<li><a href=#concept-http-equivalent><span class=secno>2.7.1 </span>Protocol concepts</a></li>
Expand Down Expand Up @@ -6482,7 +6483,70 @@ explained in the previous section, which talks about RFC 2119. -->

<div class=impl>

<h4 id=dynamic-changes-to-base-urls><span class=secno>2.6.4 </span>Dynamic changes to base URLs</h4>
<h4 id=url-manipulation-and-creation><span class=secno>2.6.4 </span>URL manipulation and creation</h4>

<p>To <dfn id=fragment-escaped title=fragment-escaped>fragment-escape</dfn> a string
<var title="">input</var>, a user agent must run the following
steps:</p>

<ol><li><p>Let <var title="">input</var> be the string to be
escaped.</li>

<li><p>Let <var title="">position</var> point at the first
character of <var title="">input</var>.</li>

<li><p>Let <var title="">output</var> be an empty string.</li>

<li><p><i>Loop</i>: If <var title="">position</var> is past the end
of <var title="">input</var>, then jump to the step labeled
<i>end</i>.</li>

<li>

<p>If the character in <var title="">input</var> pointed to by
<var title="">position</var> is in the range U+0000 to U+0020 or
is one of the following characters:</p>

<ul class=brief><li>U+0022 QUOTATION MARK character (")
<li>U+0023 NUMBER SIGN character (#)
<li>U+0025 PERCENT SIGN character (%)
<li>U+003C LESS-THAN SIGN character (&lt;)
<li>U+003E GREATER-THAN SIGN character (&gt;)
<li>U+005B LEFT SQUARE BRACKET character ([)
<li>U+005C REVERSE SOLIDUS character (\)
<li>U+005D RIGHT SQUARE BRACKET character (])
<li>U+005E CIRCUMFLEX ACCENT character (^)
<li>U+007B LEFT CURLY BRACKET character ({)
<li>U+007C VERTICAL LINE character (|)
<li>U+007D RIGHT CURLY BRACKET character (})
</ul><p>...then append the percent-encoded form of the character to
<var title="">output</var>. <a href=#refsRFC3986>[RFC3986]</a></p> <!-- this is the same
phrasing that's used elsewhere in the spec, but we really should
define 'percent-encoded' or at least ensure we consistently say
whether it's upper-case or lower-case. -->

<p>Otherwise, append the character itself to <var title="">output</var>.</p>

<p class=note>This escapes any ASCII characters that are not
valid in the URI &lt;fragment&gt; production without being
escaped.</p>

</li>

<li><p>Advance <var title="">position</var> to the next character
in <var title="">input</var>.</li>

<li><p>Return to the step labeled <i>loop</i>.</li>

<li><p><i>End</i>: Return <var title="">output</var>.</li>

</ol></div>



<div class=impl>

<h4 id=dynamic-changes-to-base-urls><span class=secno>2.6.5 </span>Dynamic changes to base URLs</h4>

<p>When an <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attribute
changes, the attribute's element, and all descendant elements, are
Expand Down Expand Up @@ -6555,7 +6619,7 @@ explained in the previous section, which talks about RFC 2119. -->



<h4 id=interfaces-for-url-manipulation><span class=secno>2.6.5 </span>Interfaces for URL manipulation</h4>
<h4 id=interfaces-for-url-manipulation><span class=secno>2.6.6 </span>Interfaces for URL manipulation</h4>

<p>An interface that has a complement of <dfn id=url-decomposition-idl-attributes>URL decomposition IDL
attributes</dfn> has seven attributes with the following
Expand Down Expand Up @@ -45350,7 +45414,7 @@ interface <dfn id=htmlformelement>HTMLFormElement</dfn> : <a href=#htmlelement>H
owner</a>.</li>

<li>They both have a <code title=attr-fe-name><a href=#attr-fe-name>name</a></code>
attribute, their code title="attr-fe-name"&gt;name attributes
attribute, their <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attributes
are not empty, and the value of <var title="">a</var>'s <code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute is a <a href=#compatibility-caseless>compatibility
caseless</a> match for the value of <var title="">b</var>'s
<code title=attr-fe-name><a href=#attr-fe-name>name</a></code> attribute.</li>
Expand Down Expand Up @@ -58983,7 +59047,7 @@ END:VCARD</pre>
characters (:), generate the following triple:</p>

<dl class=triple><dt>subject <dd> <a href="#the-document's-current-address">the document's current address</a>
<dt>predicate <dd> the concatenation of the string "<code title="">http://www.w3.org/1999/xhtml/vocab#</code>" and <var title="">token</var>, with any characters in <var title="">token</var> that are not valid in the &lt;ifragment&gt; production of the IRI syntax being %-escaped <a href=#refsRFC3987>[RFC3987]</a>
<dt>predicate <dd> the <a href=#fragment-escaped>fragment-escaped</a> concatenation of the string "<code title="">http://www.w3.org/1999/xhtml/vocab#</code>" and <var title="">token</var>
<dt>object <dd> the <a href=#absolute-url>absolute URL</a> that results from <a href=#resolve-a-url title="resolve a URL">resolving</a> the value of the element's <code title="">href</code> attribute relative to the element
</dl><p>For each token <var title="">token</var> in <var title="">list of tokens</var> that is an <a href=#absolute-url>absolute
URL</a>, generate the following triple:</p>
Expand All @@ -59005,7 +59069,7 @@ END:VCARD</pre>
triple:</p>

<dl class=triple><dt>subject <dd> <a href="#the-document's-current-address">the document's current address</a>
<dt>predicate <dd> the concatenation of the string "<code title="">http://www.w3.org/1999/xhtml/vocab#</code>" and the value of the element's <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute, <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>, with any characters in the value that are not valid in the &lt;ifragment&gt; production of the IRI syntax being %-escaped <a href=#refsRFC3987>[RFC3987]</a>
<dt>predicate <dd> the <a href=#fragment-escaped>fragment-escaped</a> concatenation of the string "<code title="">http://www.w3.org/1999/xhtml/vocab#</code>" and the value of the element's <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute, <a href=#converted-to-ascii-lowercase>converted to ASCII lowercase</a>
<dt>object <dd> the value of the element's <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> attribute, as a plain literal, with the language information set from the <a href=#language>language</a> of the element, if it is not unknown
</dl><p>For each <code><a href=#the-meta-element>meta</a></code> element in the <code><a href=#document>Document</a></code>
that has a <code title=attr-meta-name><a href=#attr-meta-name>name</a></code> attribute and
Expand Down Expand Up @@ -59137,10 +59201,7 @@ END:VCARD</pre>
character (%), a U+0032 DIGIT TWO character (2), and a U+0030
DIGIT ZERO character (0) to <var title="">type</var>.</li>

<li><p>Append the value of <var title="">fallback name</var> to
<var title="">type</var>, with any characters in <var title="">fallback name</var> that are not valid in the
&lt;ifragment&gt; production of the IRI syntax being
%-escaped. <a href=#refsRFC3987>[RFC3987]</a></li>
<li><p>Append the <a href=#fragment-escaped>fragment-escaped</a> value of <var title="">fallback name</var> to <var title="">type</var>.</li>

</ol></li>

Expand Down Expand Up @@ -59198,18 +59259,15 @@ END:VCARD</pre>
SIGN character (%), a U+0032 DIGIT TWO character (2), and a
U+0030 DIGIT ZERO character (0) to <var title="">s</var>.</li>

<li><p>Append the value of <var title="">name</var> to <var title="">s</var>, with any characters in <var title="">name</var> that are not valid in the
&lt;ifragment&gt; production of the IRI syntax being
%-escaped. <a href=#refsRFC3987>[RFC3987]</a></li>
<li><p>Append the <a href=#fragment-escaped>fragment-escaped</a> value of
<var title="">name</var> to <var title="">s</var>.</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, 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 -->
and the <a href=#fragment-escaped>fragment-escaped</a> value of <var title="">s</var>.</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>
Expand Down

0 comments on commit 439a11f

Please sign in to comment.