[html5] r1970 - [e] (0) Rearrange sections around so that related topics are closer together.
whatwg at whatwg.org
whatwg at whatwg.org
Thu Jul 31 22:23:57 PDT 2008
Author: ianh
Date: 2008-07-31 22:23:56 -0700 (Thu, 31 Jul 2008)
New Revision: 1970
Modified:
index
source
Log:
[e] (0) Rearrange sections around so that related topics are closer together.
Modified: index
===================================================================
--- index 2008-08-01 00:46:19 UTC (rev 1969)
+++ index 2008-08-01 05:23:56 UTC (rev 1970)
@@ -227,128 +227,128 @@
<li><a href="#case-sensitivity"><span class=secno>2.3
</span>Case-sensitivity</a>
- <li><a href="#urls"><span class=secno>2.4 </span>URLs</a>
- <ul class=toc>
- <li><a href="#terminology0"><span class=secno>2.4.1
- </span>Terminology</a>
-
- <li><a href="#parsing0"><span class=secno>2.4.2 </span>Parsing
- URLs</a>
-
- <li><a href="#resolving"><span class=secno>2.4.3 </span>Resolving
- URLs</a>
-
- <li><a href="#dynamic"><span class=secno>2.4.4 </span>Dynamic changes
- to base URLs</a>
-
- <li><a href="#interfaces"><span class=secno>2.4.5 </span>Interfaces
- for URL manipulation</a>
- </ul>
-
- <li><a href="#common0"><span class=secno>2.5 </span>Common
+ <li><a href="#common0"><span class=secno>2.4 </span>Common
microsyntaxes</a>
<ul class=toc>
- <li><a href="#common1"><span class=secno>2.5.1 </span>Common parser
+ <li><a href="#common1"><span class=secno>2.4.1 </span>Common parser
idioms</a>
- <li><a href="#boolean"><span class=secno>2.5.2 </span>Boolean
+ <li><a href="#boolean"><span class=secno>2.4.2 </span>Boolean
attributes</a>
- <li><a href="#numbers"><span class=secno>2.5.3 </span>Numbers</a>
+ <li><a href="#numbers"><span class=secno>2.4.3 </span>Numbers</a>
<ul class=toc>
- <li><a href="#unsigned"><span class=secno>2.5.3.1. </span>Unsigned
+ <li><a href="#unsigned"><span class=secno>2.4.3.1. </span>Unsigned
integers</a>
- <li><a href="#signed"><span class=secno>2.5.3.2. </span>Signed
+ <li><a href="#signed"><span class=secno>2.4.3.2. </span>Signed
integers</a>
- <li><a href="#real-numbers"><span class=secno>2.5.3.3. </span>Real
+ <li><a href="#real-numbers"><span class=secno>2.4.3.3. </span>Real
numbers</a>
- <li><a href="#ratios"><span class=secno>2.5.3.4. </span>Ratios</a>
+ <li><a href="#ratios"><span class=secno>2.4.3.4. </span>Ratios</a>
- <li><a href="#percentages-and-dimensions"><span class=secno>2.5.3.5.
+ <li><a href="#percentages-and-dimensions"><span class=secno>2.4.3.5.
</span>Percentages and dimensions</a>
- <li><a href="#lists"><span class=secno>2.5.3.6. </span>Lists of
+ <li><a href="#lists"><span class=secno>2.4.3.6. </span>Lists of
integers</a>
</ul>
- <li><a href="#dates"><span class=secno>2.5.4 </span>Dates and
+ <li><a href="#dates"><span class=secno>2.4.4 </span>Dates and
times</a>
<ul class=toc>
- <li><a href="#specific"><span class=secno>2.5.4.1. </span>Specific
+ <li><a href="#specific"><span class=secno>2.4.4.1. </span>Specific
moments in time</a>
- <li><a href="#vaguer"><span class=secno>2.5.4.2. </span>Vaguer
+ <li><a href="#vaguer"><span class=secno>2.4.4.2. </span>Vaguer
moments in time</a>
</ul>
- <li><a href="#time-offsets"><span class=secno>2.5.5 </span>Time
+ <li><a href="#time-offsets"><span class=secno>2.4.5 </span>Time
offsets</a>
- <li><a href="#tokens"><span class=secno>2.5.6 </span>Tokens</a>
+ <li><a href="#tokens"><span class=secno>2.4.6 </span>Tokens</a>
- <li><a href="#keywords"><span class=secno>2.5.7 </span>Keywords and
+ <li><a href="#keywords"><span class=secno>2.4.7 </span>Keywords and
enumerated attributes</a>
- <li><a href="#syntax-references"><span class=secno>2.5.8
+ <li><a href="#syntax-references"><span class=secno>2.4.8
</span>References</a>
</ul>
- <li><a href="#common2"><span class=secno>2.6 </span>Common DOM
- interfaces</a>
+ <li><a href="#urls"><span class=secno>2.5 </span>URLs</a>
<ul class=toc>
- <li><a href="#reflecting"><span class=secno>2.6.1 </span>Reflecting
- content attributes in DOM attributes</a>
+ <li><a href="#terminology0"><span class=secno>2.5.1
+ </span>Terminology</a>
- <li><a href="#collections"><span class=secno>2.6.2
- </span>Collections</a>
- <ul class=toc>
- <li><a href="#htmlcollection"><span class=secno>2.6.2.1.
- </span>HTMLCollection</a>
+ <li><a href="#parsing0"><span class=secno>2.5.2 </span>Parsing
+ URLs</a>
- <li><a href="#htmlformcontrolscollection"><span class=secno>2.6.2.2.
- </span>HTMLFormControlsCollection</a>
+ <li><a href="#resolving"><span class=secno>2.5.3 </span>Resolving
+ URLs</a>
- <li><a href="#htmloptionscollection"><span class=secno>2.6.2.3.
- </span>HTMLOptionsCollection</a>
- </ul>
+ <li><a href="#dynamic"><span class=secno>2.5.4 </span>Dynamic changes
+ to base URLs</a>
- <li><a href="#domtokenlist"><span class=secno>2.6.3
- </span>DOMTokenList</a>
-
- <li><a href="#domstringmap"><span class=secno>2.6.4
- </span>DOMStringMap</a>
-
- <li><a href="#dom-feature"><span class=secno>2.6.5 </span>DOM feature
- strings</a>
+ <li><a href="#interfaces"><span class=secno>2.5.5 </span>Interfaces
+ for URL manipulation</a>
</ul>
- <li><a href="#fetching"><span class=secno>2.7 </span>Fetching
+ <li><a href="#fetching"><span class=secno>2.6 </span>Fetching
resources</a>
- <li><a href="#content-type-sniffing"><span class=secno>2.8
+ <li><a href="#content-type-sniffing"><span class=secno>2.7
</span>Determining the type of a resource</a>
<ul class=toc>
- <li><a href="#content-type"><span class=secno>2.8.1
+ <li><a href="#content-type"><span class=secno>2.7.1
</span>Content-Type metadata</a>
- <li><a href="#content-type0"><span class=secno>2.8.2
+ <li><a href="#content-type0"><span class=secno>2.7.2
</span>Content-Type sniffing: Web pages</a>
- <li><a href="#content-type1"><span class=secno>2.8.3
+ <li><a href="#content-type1"><span class=secno>2.7.3
</span>Content-Type sniffing: text or binary</a>
- <li><a href="#content-type2"><span class=secno>2.8.4
+ <li><a href="#content-type2"><span class=secno>2.7.4
</span>Content-Type sniffing: unknown type</a>
- <li><a href="#content-type3"><span class=secno>2.8.5
+ <li><a href="#content-type3"><span class=secno>2.7.5
</span>Content-Type sniffing: image</a>
- <li><a href="#content-type4"><span class=secno>2.8.6
+ <li><a href="#content-type4"><span class=secno>2.7.6
</span>Content-Type sniffing: feed or HTML</a>
</ul>
+
+ <li><a href="#common2"><span class=secno>2.8 </span>Common DOM
+ interfaces</a>
+ <ul class=toc>
+ <li><a href="#reflecting"><span class=secno>2.8.1 </span>Reflecting
+ content attributes in DOM attributes</a>
+
+ <li><a href="#collections"><span class=secno>2.8.2
+ </span>Collections</a>
+ <ul class=toc>
+ <li><a href="#htmlcollection"><span class=secno>2.8.2.1.
+ </span>HTMLCollection</a>
+
+ <li><a href="#htmlformcontrolscollection"><span class=secno>2.8.2.2.
+ </span>HTMLFormControlsCollection</a>
+
+ <li><a href="#htmloptionscollection"><span class=secno>2.8.2.3.
+ </span>HTMLOptionsCollection</a>
+ </ul>
+
+ <li><a href="#domtokenlist"><span class=secno>2.8.3
+ </span>DOMTokenList</a>
+
+ <li><a href="#domstringmap"><span class=secno>2.8.4
+ </span>DOMStringMap</a>
+
+ <li><a href="#dom-feature"><span class=secno>2.8.5 </span>DOM feature
+ strings</a>
+ </ul>
</ul>
<li><a href="#dom"><span class=secno>3. </span>Semantics and structure of
@@ -2909,707 +2909,8 @@
corresponding characters in the range U+0061 .. U+007A (i.e. LATIN SMALL
LETTER A to LATIN SMALL LETTER Z).
- <h3 id=urls><span class=secno>2.4 </span>URLs</h3>
+ <h3 id=common0><span class=secno>2.4 </span>Common microsyntaxes</h3>
- <p>This specification defines the term <a href="#url">URL</a>, and defines
- various algorithms for dealing with URLs, because for historical reasons
- the rules defined by the URI and IRI specifications are not a complete
- description of what HTML user agents need to implement to be compatible
- with Web content.
-
- <h4 id=terminology0><span class=secno>2.4.1 </span>Terminology</h4>
-
- <p>A <dfn id=url>URL</dfn> is a string used to identify a resource. <span
- id=urldoc>A <a href="#url">URL</a> is always associated with a
- <code>Document</code>, either explicitly when the URL is created or
- defined; or through a DOM node, in which case the associated
- <code>Document</code> is the node's <code>Document</code>; or through a
- script, in which case the associated <code>Document</code> is the script's
- <a href="#script4">script document context</a>.</span>
-
- <p>A <a href="#url">URL</a> is a <dfn id=valid>valid URL</dfn> if at least
- one of the following conditions holds:
-
- <ul>
- <li>
- <p>The <a href="#url">URL</a> is a valid URI reference <a
- href="#refsRFC3986">[RFC3986]</a>.
-
- <li>
- <p>The <a href="#url">URL</a> is a valid IRI reference and it has no
- query component. <a href="#refsRFC3987">[RFC3987]</a>
-
- <li>
- <p>The <a href="#url">URL</a> is a valid IRI reference and its query
- component contains no unescaped non-ASCII characters. <a
- href="#refsRFC3987">[RFC3987]</a>
-
- <li>
- <p>The <a href="#url">URL</a> is a valid IRI reference and the <a
- href="#character3" title="document's character encoding">character
- encoding</a> of the URL's <code>Document</code> is UTF-8 or UTF-16. <a
- href="#refsRFC3987">[RFC3987]</a>
- </ul>
-
- <p class=note>The term "URL" in this specification is used in a manner
- distinct from the precise technical meaning it is given in RFC 3986.
- Readers familiar with that RFC will find it easier to read <em>this</em>
- specification if they pretend the term "URL" as used herein is really
- called something else altogether.
-
- <h4 id=parsing0><span class=secno>2.4.2 </span>Parsing URLs</h4>
-
- <p>To <dfn id=parse0>parse a URL</dfn> <var title="">url</var> into its
- component parts, the user agent must use the following steps:
-
- <ol>
- <li>
- <p>Strip leading and trailing <a href="#space" title="space
- character">space characters</a> from <var title="">url</var>.
-
- <li>
- <p>Parse <var title="">url</var> in the manner defined by RFC 3986, with
- the following exceptions:</p>
-
- <ul>
- <li>Add all characters with codepoints less than or equal to U+0020 or
- greater than or equal to U+007F to the <unreserved> production.
-
- <li>Add the characters U+0022, U+003C, U+003E, U+005B .. U+005E, U+0060,
- and U+007B .. U+007D to the <unreserved> production. <!--
- 0022 QUOTATION MARK
- 003C LESS-THAN SIGN
- 003E GREATER-THAN SIGN
- 005B LEFT SQUARE BRACKET
- 005C REVERSE SOLIDUS
- 005D RIGHT SQUARE BRACKET
- 005E CIRCUMFLEX ACCENT
- 0060 GRAVE ACCENT
- 007B LEFT CURLY BRACKET
- 007C VERTICAL LINE
- 007D RIGHT CURLY BRACKET
- -->
-
-
- <li>Add a single U+0025 PERCENT SIGN character as a second alternative
- way of matching the <pct-encoded> production, except when the
- <pct-encoded> is used in the <reg-name> production.
-
- <li>Add the U+0023 NUMBER SIGN character to the characters allowed in
- the <fragment> production.</li>
- <!-- some browsers also have other differences, e.g. Mozilla
- seems to treat ";" as if it was not in sub-delims, if the scheem
- is "ftp". -->
- </ul>
-
- <li>
- <p>If <var title="">url</var> doesn't match the <URI-reference>
- production, even after the above changes are made to the ABNF
- definitions, then parsing the URL fails with an error. <a
- href="#refsRFC3986">[RFC3986]</a></p>
-
- <p>Otherwise, parsing <var title="">url</var> was successful; the
- components of the URL are substrings of <var title="">url</var> defined
- as follows:</p>
-
- <dl>
- <dt><dfn id=ltschemegt title=url-scheme><scheme></dfn>
-
- <dd>
- <p>The substring matched by the <scheme> production, if any.
-
- <dt><dfn id=lthostgt title=url-host><host></dfn>
-
- <dd>
- <p>The substring matched by the <host> production, if any.
-
- <dt><dfn id=ltportgt title=url-port><port></dfn>
-
- <dd>
- <p>The substring matched by the <port> production, if any.
-
- <dt><dfn id=lthostportgt title=url-hostport><hostport></dfn>
-
- <dd>
- <p>If there is a <scheme> component and a <port> component
- and the port given by the <port> component is different than the
- default port defined for the protocol given by the <scheme>
- component, then <hostport> is the substring that starts with the
- substring matched by the <host> production and ends with the
- substring matched by the <port> production, and includes the
- colon in between the two. Otherwise, it is the same as the
- <host> component.</p>
-
- <dt><dfn id=ltpathgt title=url-path><path></dfn>
-
- <dd>
- <p>The substring matched by one of the following productions, if one of
- them was matched:</p>
-
- <ul class=brief>
- <li><path-abempty>
-
- <li><path-absolute>
-
- <li><path-noscheme>
-
- <li><path-rootless>
-
- <li><path-empty>
- </ul>
-
- <dt><dfn id=ltquerygt title=url-query><query></dfn>
-
- <dd>
- <p>The substring matched by the <query> production, if any.
-
- <dt><dfn id=ltfragmentgt title=url-fragment><fragment></dfn>
-
- <dd>
- <p>The substring matched by the <fragment> production, if any.
- </dl>
- </ol>
- <!-- XXX we might want to define "server-based naming authority",
- it's not clear RFC3986 does a good job of defining that anymore
- (earlier URI specs did) -->
-
- <h4 id=resolving><span class=secno>2.4.3 </span>Resolving URLs</h4>
-
- <p>Relative URLs are resolved relative to a base URL. The <dfn
- id=base->base URL</dfn> of a <a href="#url">URL</a> is the <a
- href="#absolute">absolute URL</a> obtained as follows:
-
- <dl class=switch>
- <dt>If the URL to be resolved was passed to an API
-
- <dd>
- <p>The base URL is the <a href="#document0">document base URL</a> of the
- script's <a href="#script4">script document context</a>.
-
- <dt>If the URL to be resolved is from the value of a content attribute
-
- <dd>
- <p>The base URL is the <i>base URI of the element</i> that the attribute
- is on, as defined by the XML Base specification, with <i>the base URI of
- the document entity</i> being defined as the <a
- href="#document0">document base URL</a> of the <code>Document</code>
- that owns the element.</p>
-
- <p>For the purposes of the XML Base specification, user agents must act
- as if all <code>Document</code> objects represented XML documents.</p>
-
- <p class=note>It is possible for <code title=attr-xml-base><a
- href="#xmlbase">xml:base</a></code> attributes to be present even in
- HTML fragments, as such attributes can be added dynamically using
- script. (Such scripts would not be conforming, however, as <code
- title=attr-xml-base><a href="#xmlbase">xml:base</a></code> attributes
- are not allowed in <a href="#html-">HTML documents</a>.)</p>
-
- <dt>If the URL to be resolved was found in an offline application cache
- manifest
-
- <dd>
- <p>The base URL is the URL of the <a href="#application0">application
- cache</a> <a href="#the-manifest"
- title=concept-appcache-manifest>manifest</a>.
- </dl>
-
- <p>The <dfn id=document0>document base URL</dfn> of a <code>Document</code>
- is the <a href="#absolute">absolute URL</a> obtained by running these
- steps:
-
- <ol>
- <li>
- <p>If there is no <code><a href="#base">base</a></code> element that is
- both a child of <a href="#the-head0">the <code>head</code> element</a>
- and has an <code title=attr-base-href><a href="#href">href</a></code>
- attribute, then the <a href="#document0">document base URL</a> is
- <span>the document's address</span><!-- XXXDOCURL -->.
-
- <li>
- <p>Otherwise, let <var title="">url</var> be the value of the <code
- title=attr-base-href><a href="#href">href</a></code> attribute of the
- first such element.
-
- <li>
- <p><a href="#resolve" title="resolve a URL">Resolve</a> the <var
- title="">url</var> URL, using <span>the document's
- address</span><!-- XXXDOCURL --> as the <a href="#base-">base URL</a>
- (thus, the <code><a href="#base">base</a></code> <code
- title=attr-base-href><a href="#href">href</a></code> attribute isn't
- affect by <code title=attr-xml-base><a
- href="#xmlbase">xml:base</a></code> attributes).
-
- <li>
- <p>The <a href="#document0">document base URL</a> is the result of the
- previous step if it was successful; otherwise it is <span>the document's
- address</span><!-- XXXDOCURL -->.
- </ol>
-
- <p>To <dfn id=resolve>resolve a URL</dfn> to an <a
- href="#absolute">absolute URL</a> the user agent must use the following
- steps. Resolving a URL can result in an error, in which case the URL is
- not resolvable.
-
- <ol>
- <li>
- <p>Let <var title="">url</var> be the <a href="#url">URL</a> being
- resolved.
-
- <li>
- <p>Let <var title="">document</var> be the <code>Document</code> <a
- href="#urldoc">associated with</a> <var title="">url</var>.
-
- <li>
- <p>Let <var title="">encoding</var> be the <a href="#character3"
- title="document's character encoding">character encoding</a> of <var
- title="">document</var>.
-
- <li>
- <p>If <var title="">encoding</var> is UTF-16, then change it to UTF-8.
-
- <li>
- <p>Let <var title="">base</var> be the <a href="#base-">base URL</a> for
- <var title="">url</var>. (This is an <a href="#absolute">absolute
- URL</a>.)
-
- <li>
- <p><a href="#parse0" title="parse a URL">Parse</a> <var
- title="">url</var> into its component parts.
-
- <li>
- <p>If parsing <var title="">url</var> resulted in a <a href="#lthostgt"
- title=url-host><host></a> component, then replace the matching
- subtring of <var title="">url</var> with the string that results from
- expanding any sequences of percent-encoded octets in that component that
- are valid UTF-8 sequences into Unicode characters as defined by UTF-8.</p>
-
- <p>If any percent-encoded octets in that component are not valid UTF-8
- sequences, then return an error and abort these steps.</p>
-
- <p>Apply the IDNA ToASCII algorithm to the matching substring, with both
- the AllowUnassigned and UseSTD3ASCIIRules flags set. Replace the
- matching substring with the result of the ToASCII algorithm.</p>
-
- <p>If ToASCII fails to convert one of the components of the string, e.g.
- because it is too long or because it contains invalid characters, then
- return an error and abort these steps. <a
- href="#refsRFC3490">[RFC3490]</a></p>
-
- <li>
- <p>If parsing <var title="">url</var> resulted in a <a href="#ltpathgt"
- title=url-path><path></a> component, then replace the matching
- substring of <var title="">url</var> with the string that results from
- applying the following steps to each character other than U+0025 PERCENT
- SIGN (%) that doesn't match the original <path> production defined
- in RFC 3986:</p>
-
- <ol>
- <li>Encode the character into a sequence of octets as defined by UTF-8.
-
- <li>Replace the character with the percent-encoded form of those octets.
- <a href="#refsRFC3986">[RFC3986]</a>
- </ol>
-
- <div class=example>
- <p>For instance if <var title="">url</var> was "<code
- title="">//example.com/a^b☺c%FFd%z/?e</code>", then the <a
- href="#ltpathgt" title=url-path><path></a> component's substring
- would be "<code title="">/a^b☺c%FFd%z/</code>" and the two
- characters that would have to be escaped would be "<code
- title="">^</code>" and "<code title="">☺</code>". The result
- after this step was applied would therefore be that <var
- title="">url</var> now had the value "<code
- title="">//example.com/a%5Eb%E2%98%BAc%FFd%z/?e</code>".</p>
- </div>
-
- <li>
- <p>If parsing <var title="">url</var> resulted in a <a href="#ltquerygt"
- title=url-query><query></a> component, then replace the matching
- substring of <var title="">url</var> with the string that results from
- applying the following steps to each character other than U+0025 PERCENT
- SIGN (%) that doesn't match the original <query> production
- defined in RFC 3986:</p>
-
- <ol>
- <li>If the character in question cannot be expressed in the encoding
- <var title="">encoding</var>, then replace it with a single 0x3F octet
- (an ASCII question mark) and skip the remaining substeps for this
- character.
-
- <li>Encode the character into a sequence of octets as defined by the
- encoding <var title="">encoding</var>.
-
- <li>Replace the character with the percent-encoded form of those octets.
- <a href="#refsRFC3986">[RFC3986]</a>
- </ol>
-
- <li>
- <p>Apply the algorithm described in RFC 3986 section 5.2 Relative
- Resolution, using <var title="">url</var> as the potentially relative
- URI reference (<var title="">R</var>), and <var title="">base</var> as
- the base URI (<var title="">Base</var>). <a
- href="#refsRFC3986">[RFC3986]</a>
-
- <li>
- <p>Apply any relevant conformance criteria of RFC 3986 and RFC 3987,
- returning an error and aborting these steps if appropriate. <a
- href="#refsRFC3986">[RFC3986]</a> <a href="#refsRFC3987">[RFC3987]</a></p>
-
- <p class=example>For instance, if an absolute URI that would be returned
- by the above algorithm violates the restrictions specific to its scheme,
- e.g. a <code title="">data:</code> URI using the "<code
- title="">//</code>" server-based naming authority syntax, then user
- agents are to treat this as an error instead.<!-- RFC
- 3986, 3.1 Scheme --></p>
-
- <li>
- <p>Let <var title="">result</var> be the target URI (<var
- title="">T</var>) returned by the Relative Resolution algorithm.
-
- <li>
- <p>If <var title="">result</var> uses a scheme with a server-based naming
- authority, replace all U+005C REVERSE SOLIDUS (\) characters in <var
- title="">result</var> with U+002F SOLIDUS (/) characters.
-
- <li>
- <p>Return <var title="">result</var>.
- </ol>
-
- <p>A <a href="#url">URL</a> is an <dfn id=absolute>absolute URL</dfn> if <a
- href="#resolve" title="resolve a URL">resolving</a> it results in the same
- URL without an error.
-
- <h4 id=dynamic><span class=secno>2.4.4 </span>Dynamic changes to base URLs</h4>
-
- <p>When an <code title=attr-xml-base><a href="#xmlbase">xml:base</a></code>
- attribute changes, the attribute's element, and all descendant elements,
- are <a href="#affected">affected by a base URL change</a>.
-
- <p>When a document's <a href="#document0">document base URL</a> changes,
- all elements in that document are <a href="#affected">affected by a base
- URL change</a>.
-
- <p>When an element is moved from one document to another, if the two
- documents have different <a href="#document0" title="document base
- URL">base URLs</a>, then that element and all its descendants are <a
- href="#affected">affected by a base URL change</a>.
-
- <p>When an element is <dfn id=affected>affected by a base URL change</dfn>,
- it must act as described in the following list:
-
- <dl class=switch>
- <dt>If the element is a <a href="#hyperlinks" title=hyperlink>hyperlink
- element</a>
-
- <dd>
- <p>If the <a href="#absolute">absolute URL</a> identified by the
- hyperlink is being shown to the user, or if any data derived from that
- URL is affecting the display, then the <code
- title=attr-hyperlink-href><a href="#href6">href</a></code> attribute
- should be <a href="#resolve" title="resolve a url">reresolved</a> and
- the UI updated appropriately.</p>
-
- <p class=example>For example, the CSS <code title="">:link</code>/<code
- title="">:visited</code> pseudo-classes might have been affected.</p>
-
- <p>If the hyperlink has a <code title=attr-hyperlink-ping><a
- href="#ping">ping</a></code> attribute and its <a href="#absolute"
- title="absolute URL">absolute URL(s)</a> are being shown to the user,
- then the <code title=attr-hyperlink-ping><a href="#ping">ping</a></code>
- attribute's tokens should be <a href="#resolve" title="resolve a
- url">reresolved</a> and the UI updated appropriately.</p>
-
- <dt>If the element is a <code><a href="#blockquote">blockquote</a></code>,
- <code><a href="#q">q</a></code>, <code><a href="#ins">ins</a></code>, or
- <code><a href="#del">del</a></code> element with a <code
- title="">cite</code> attribute
-
- <dd>
- <p>If the <a href="#absolute">absolute URL</a> identified by the <code
- title="">cite</code> attribute is being shown to the user, or if any
- data derived from that URL is affecting the display, then the it should
- be <a href="#resolve" title="resolve a url">reresolved</a> and the UI
- updated appropriately.</p>
-
- <dt>Otherwise
-
- <dd>
- <p>The element is not directly affected.</p>
-
- <p class=example>Changing the base URL doesn't affect the image displayed
- by <code><a href="#img">img</a></code> elements, although subsequent
- accesses of the <code title=dom-img-src><a href="#src0">src</a></code>
- DOM attribute from script will return a new <a href="#absolute">absolute
- URL</a> that might no longer correspond to the image being shown.</p>
- </dl>
-
- <h4 id=interfaces><span class=secno>2.4.5 </span>Interfaces for URL
- manipulation</h4>
-
- <p>An interface that has a complement of <dfn id=url-decomposition>URL
- decomposition attributes</dfn> will have seven attributes with the
- following definitions:
-
- <pre class=idl>
- attribute DOMString <a href="#protocol" title=dom-uda-protocol>protocol</a>;
- attribute DOMString <a href="#host" title=dom-uda-host>host</a>;
- attribute DOMString <a href="#hostname" title=dom-uda-hostname>hostname</a>;
- attribute DOMString <a href="#port" title=dom-uda-port>port</a>;
- attribute DOMString <a href="#pathname" title=dom-uda-pathname>pathname</a>;
- attribute DOMString <a href="#search" title=dom-uda-search>search</a>;
- attribute DOMString <a href="#hash" title=dom-uda-hash>hash</a>;
-</pre>
-
- <p>The attributes defined to be URL decomposition attributes must act as
- described for the attributes with the same corresponding names in this
- section.
-
- <p>In addition, an interface with a complement of URL decomposition
- attributes will define an <dfn id=input
- title=concept-uda-input>input</dfn>, which is a <a href="#url">URL</a>
- that the attributes act on, and a <dfn id=common3
- title=concept-uda-setter>common setter action</dfn>, which is a set of
- steps invoked when any of the attributes' setters are invoked.
-
- <p>The seven URL decomposition attributes have similar requirements.
-
- <p>On getting, if the <a href="#input" title=concept-uda-input>input</a>
- fulfills the condition given in the "getter condition" column
- corresponding to the attribute in the table below, the user agent must
- return the part of the <a href="#input" title=concept-uda-input>input</a>
- URL given in the "component" column, with any prefixes specified in the
- "prefix" column appropriately added to the start of the string and any
- suffixes specified in the "suffix" column appropriately added to the end
- of the string. Otherwise, the attribute must return the empty string.
-
- <p>On setting, the new value must first be mutated as described by the
- "setter preprocessor" column, then mutated by %-escaping any characters in
- the new value that are not valid in the relevant component as given by the
- "component" column. Then, if the resulting new value fulfills the
- condition given in the "setter condition" column, the user agent must make
- a new string <var title="">output</var> by replacing the component of the
- URL given by the "component" column in the <a href="#input"
- title=concept-uda-input>input</a> URL with the new value; otherwise, the
- user agent must let <var title="">output</var> be equal to the <a
- href="#input" title=concept-uda-input>input</a>. Finally, the user agent
- must invoke the <a href="#common3" title=concept-uda-setter>common setter
- action</a> with the value of <var title="">output</var>.
-
- <p>When replacing a component in the URL, if the component is part of an
- optional group in the URL syntax consisting of a character followed by the
- component, the component (including its prefix character) must be included
- even if the new value is the empty string.
-
- <p class=note>The previous paragraph applies in particular to the "<code
- title="">:</code>" before a <port> component, the "<code
- title="">?</code>" before a <query> component, and the "<code
- title="">#</code>" before a <fragment> component.
-
- <p>For the purposes of the above definitions, URLs must be parsed using the
- <a href="#parse0" title="parse a URL">URL parsing rules</a> defined in
- this specification.
-
- <table>
- <thead>
- <tr>
- <th>Attribute
-
- <th>Component
-
- <th>Getter Condition
-
- <th>Prefix
-
- <th>Suffix
-
- <th>Setter Preprocessor
-
- <th>Setter Condition
-
- <tbody>
- <tr>
- <td><dfn id=protocol title=dom-uda-protocol><code>protocol</code></dfn>
-
- <td><a href="#ltschemegt" title=url-scheme><scheme></a>
-
- <td>—
-
- <td>—
-
- <td>U+003A COLON ("<code title="">:</code>")
-
- <td>Remove all trailing U+003A COLON ("<code title="">:</code>")
- characters
-
- <td>The new value is not the empty string
-
- <tr>
- <td><dfn id=host title=dom-uda-host><code>host</code></dfn>
-
- <td><a href="#lthostportgt" title=url-hostport><hostport></a>
-
- <td><a href="#input" title=concept-uda-input>input</a> is hierarchical
- and uses a server-based naming authority
-
- <td>—
-
- <td>—
-
- <td>—
-
- <td>—
-
- <tr>
- <td><dfn id=hostname title=dom-uda-hostname><code>hostname</code></dfn>
-
- <td><a href="#lthostgt" title=url-host><host></a>
-
- <td><a href="#input" title=concept-uda-input>input</a> is hierarchical
- and uses a server-based naming authority
-
- <td>—
-
- <td>—
-
- <td>Remove all leading U+002F SOLIDUS ("<code title="">/</code>")
- characters
-
- <td>—
-
- <tr>
- <td><dfn id=port title=dom-uda-port><code>port</code></dfn>
-
- <td><a href="#ltportgt" title=url-port><port></a>
-
- <td><a href="#input" title=concept-uda-input>input</a> is hierarchical,
- uses a server-based naming authority, and contained a <a
- href="#ltportgt" title=url-port><port></a> component (possibly an
- empty one)
-
- <td>—
-
- <td>—
-
- <td>Remove any characters in the new value that are not in the range
- U+0030 DIGIT ZERO .. U+0039 DIGIT NINE. If the resulting string is
- empty, set it to a single U+0030 DIGIT ZERO character ('0').
-
- <td>—
-
- <tr>
- <td><dfn id=pathname title=dom-uda-pathname><code>pathname</code></dfn>
-
- <td><a href="#ltpathgt" title=url-path><path></a>
-
- <td><a href="#input" title=concept-uda-input>input</a> is hierarchical
-
- <td>—
-
- <td>—
-
- <td>If it has no leading U+002F SOLIDUS ("<code title="">/</code>")
- character, prepend a U+002F SOLIDUS ("<code title="">/</code>")
- character to the new value
-
- <td>—
-
- <tr>
- <td><dfn id=search title=dom-uda-search><code>search</code></dfn>
-
- <td><a href="#ltquerygt" title=url-query><query></a>
-
- <td><a href="#input" title=concept-uda-input>input</a> is hierarchical,
- and contained a <a href="#ltquerygt" title=url-query><query></a>
- component (possibly an empty one)
-
- <td>U+003F QUESTION MARK ("<code title="">?</code>")
-
- <td>—
-
- <td>Remove one leading U+003F QUESTION MARK ("<code title="">?</code>")
- character, if any
-
- <td>—
-
- <tr>
- <td><dfn id=hash title=dom-uda-hash><code>hash</code></dfn>
-
- <td><a href="#ltfragmentgt" title=url-fragment><fragment></a>
-
- <td><a href="#input" title=concept-uda-input>input</a> contained a <a
- href="#ltfragmentgt" title=url-fragment><fragment></a> component
- (possibly an empty one)
-
- <td>U+0023 NUMBER SIGN ("<code title="">#</code>")
-
- <td>—
-
- <td>Remove one leading U+0023 NUMBER SIGN ("<code title="">#</code>")
- character, if any
-
- <td>—
- </table>
- <!--
- http://www.hixie.ch/tests/adhoc/dom/level0/location/components/
- http://lxr.mozilla.org/seamonkey/source/dom/src/base/nsLocation.cpp
- http://wp.netscape.com/eng/mozilla/3.0/handbook/javascript/ref_h-l.htm#84722
--->
-
- <div class=example>
- <p>The table below demonstrates how the getter condition for <code
- title=dom-uda-search><a href="#search">search</a></code> results in
- different results depending on the exact original syntax of the URL:</p>
-
- <table>
- <thead>
- <tr>
- <th> Input URL
-
- <th> <code title=dom-uda-search><a href="#search">search</a></code>
- value
-
- <th> Explanation
-
- <tbody>
- <tr>
- <td> <code title="">http://example.com/</code>
-
- <td> <i>empty string</i>
-
- <td> No <a href="#ltquerygt" title=url-query><query></a>
- component in input URL.
-
- <tr>
- <td> <code title="">http://example.com/?</code>
-
- <td> <code title="">?</code>
-
- <td> There is a <a href="#ltquerygt" title=url-query><query></a>
- component, but it is empty. The question mark in the resulting value
- is the prefix.
-
- <tr>
- <td> <code title="">http://example.com/?test</code>
-
- <td> <code title="">?test</code>
-
- <td> The <a href="#ltquerygt" title=url-query><query></a>
- component has the value "<code title="">test</code>".
-
- <tr>
- <td> <code title="">http://example.com/?test#</code>
-
- <td> <code title="">?test</code>
-
- <td> The (empty) <a href="#ltfragmentgt"
- title=url-fragment><fragment></a> component is not part of the
- <a href="#ltquerygt" title=url-query><query></a> component.
- </table>
- </div>
-
- <h3 id=common0><span class=secno>2.5 </span>Common microsyntaxes</h3>
-
<p>There are various places in HTML that accept particular data types, such
as dates or numbers. This section describes what the conformance criteria
for content in those formats is, and how to parse them.</p>
@@ -3620,7 +2921,7 @@
attribute values are clearly defined either in terms of microsyntaxes or
in terms of other specs, or as "Text" or some such.
- <h4 id=common1><span class=secno>2.5.1 </span>Common parser idioms</h4>
+ <h4 id=common1><span class=secno>2.4.1 </span>Common parser idioms</h4>
<p>The <dfn id=space title="space character">space characters</dfn>, for
the purposes of this specification, are U+0020 SPACE, U+0009 CHARACTER
@@ -3666,7 +2967,7 @@
the Unicode character class Zs. In both cases, the collected characters
are not used. <a href="#refsUNICODE">[UNICODE]</a>
- <h4 id=boolean><span class=secno>2.5.2 </span>Boolean attributes</h4>
+ <h4 id=boolean><span class=secno>2.4.2 </span>Boolean attributes</h4>
<p>A number of attributes in HTML5 are <dfn id=boolean0 title="boolean
attribute">boolean attributes</dfn>. The presence of a boolean attribute
@@ -3678,11 +2979,11 @@
for the attribute's canonical name, with no leading or trailing
whitespace.
- <h4 id=numbers><span class=secno>2.5.3 </span>Numbers</h4>
+ <h4 id=numbers><span class=secno>2.4.3 </span>Numbers</h4>
- <h5 id=unsigned><span class=secno>2.5.3.1. </span>Unsigned integers</h5>
+ <h5 id=unsigned><span class=secno>2.4.3.1. </span>Unsigned integers</h5>
- <p>A string is a <dfn id=valid0>valid non-negative integer</dfn> if it
+ <p>A string is a <dfn id=valid>valid non-negative integer</dfn> if it
consists of one of more characters in the range U+0030 DIGIT ZERO (0) to
U+0039 DIGIT NINE (9).
@@ -3741,9 +3042,9 @@
<p>Return <var title="">value</var>.
</ol>
- <h5 id=signed><span class=secno>2.5.3.2. </span>Signed integers</h5>
+ <h5 id=signed><span class=secno>2.4.3.2. </span>Signed integers</h5>
- <p>A string is a <dfn id=valid1>valid integer</dfn> if it consists of one
+ <p>A string is a <dfn id=valid0>valid integer</dfn> if it consists of one
of more characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE
(9), optionally prefixed with a U+002D HYPHEN-MINUS ("-") character.
@@ -3819,9 +3120,9 @@
title="">value</var>, otherwise return 0-<var title="">value</var>.
</ol>
- <h5 id=real-numbers><span class=secno>2.5.3.3. </span>Real numbers</h5>
+ <h5 id=real-numbers><span class=secno>2.4.3.3. </span>Real numbers</h5>
- <p>A string is a <dfn id=valid2>valid floating point number</dfn> if it
+ <p>A string is a <dfn id=valid1>valid floating point number</dfn> if it
consists of one of more characters in the range U+0030 DIGIT ZERO (0) to
U+0039 DIGIT NINE (9), optionally with a single U+002E FULL STOP (".")
character somewhere (either before these numbers, in between two numbers,
@@ -3941,13 +3242,13 @@
title="">value</var>, otherwise return 0-<var title="">value</var>.
</ol>
- <h5 id=ratios><span class=secno>2.5.3.4. </span>Ratios</h5>
+ <h5 id=ratios><span class=secno>2.4.3.4. </span>Ratios</h5>
<p class=note>The algorithms described in this section are used by the
<code><a href="#progress">progress</a></code> and <code><a
href="#meter">meter</a></code> elements.
- <p>A <dfn id=valid3>valid denominator punctuation character</dfn> is one of
+ <p>A <dfn id=valid2>valid denominator punctuation character</dfn> is one of
the characters from the table below. There is <dfn id=a-value
title="values associated with denominator punctuation characters">a value
associated with each denominator punctuation character</dfn>, as shown in
@@ -4025,7 +3326,7 @@
href="#refsUNICODE">[UNICODE]</a>
<li>If there are still further characters in the string, and the next
- character in the string is a <a href="#valid3">valid denominator
+ character in the string is a <a href="#valid2">valid denominator
punctuation character</a>, set <var title="">denominator</var> to that
character.
@@ -4048,7 +3349,7 @@
sub-algorithm in step 9.
<li>If there are still further characters in the string, and the next
- character in the string is a <a href="#valid3">valid denominator
+ character in the string is a <a href="#valid2">valid denominator
punctuation character</a>, return nothing and abort these steps.
<li>If the string contains any other characters in the range U+0030 DIGIT
@@ -4083,24 +3384,24 @@
<li>Parse <var title="">string</var> according to the <a
href="#rules1">rules for parsing floating point number values</a>, to
obtain <var title="">number</var>. This step cannot fail (<var
- title="">string</var> is guaranteed to be a <a href="#valid2">valid
+ title="">string</var> is guaranteed to be a <a href="#valid1">valid
floating point number</a>).
<li>Return <var title="">number</var>.
</ol>
- <h5 id=percentages-and-dimensions><span class=secno>2.5.3.5.
+ <h5 id=percentages-and-dimensions><span class=secno>2.4.3.5.
</span>Percentages and dimensions</h5>
- <p class=big-issue><dfn id=valid4>valid positive non-zero integers</dfn>
+ <p class=big-issue><dfn id=valid3>valid positive non-zero integers</dfn>
<dfn id=rules2>rules for parsing dimension values</dfn> (only used by
height/width on img, embed, object — lengths in css pixels or
percentages)
- <h5 id=lists><span class=secno>2.5.3.6. </span>Lists of integers</h5>
+ <h5 id=lists><span class=secno>2.4.3.6. </span>Lists of integers</h5>
- <p>A <dfn id=valid5>valid list of integers</dfn> is a number of <a
- href="#valid1" title="valid integer">valid integers</a> separated by
+ <p>A <dfn id=valid4>valid list of integers</dfn> is a number of <a
+ href="#valid0" title="valid integer">valid integers</a> separated by
U+002C COMMA characters, with no other characters (e.g. no <a
href="#space" title="space character">space characters</a>). In addition,
there might be restrictions on the number of integers that can be given,
@@ -4378,7 +3679,7 @@
<p>Return the <var title="">numbers</var> list and abort.
</ol>
- <h4 id=dates><span class=secno>2.5.4 </span>Dates and times</h4>
+ <h4 id=dates><span class=secno>2.4.4 </span>Dates and times</h4>
<p>In the algorithms below, the <dfn id=number>number of days in month <var
title="">month</var> of year <var title="">year</var></dfn> is:
@@ -4389,9 +3690,9 @@
4 but not by 100; and <em>28</em> otherwise. This takes into account leap
years in the Gregorian calendar. <a href="#refsGREGORIAN">[GREGORIAN]</a>
- <h5 id=specific><span class=secno>2.5.4.1. </span>Specific moments in time</h5>
+ <h5 id=specific><span class=secno>2.4.4.1. </span>Specific moments in time</h5>
- <p>A string is a <dfn id=valid6>valid datetime</dfn> if it has four digits
+ <p>A string is a <dfn id=valid5>valid datetime</dfn> if it has four digits
(representing the year), a literal hyphen, two digits (representing the
month), a literal hyphen, two digits (representing the day), optionally
some spaces, either a literal T or a space, optionally some more spaces,
@@ -4424,7 +3725,7 @@
U+002B PLUS SIGN, and the minus U+002D (same as the hyphen).
<div class=example>
- <p>The following are some examples of dates written as <a href="#valid6"
+ <p>The following are some examples of dates written as <a href="#valid5"
title="valid datetime">valid datetimes</a>.</p>
<dl>
@@ -4477,7 +3778,7 @@
user agent must apply the following algorithm to the string. This will
either return a time in UTC, with associated timezone information for
round tripping or display purposes, or nothing, indicating the value is
- not a <a href="#valid6">valid datetime</a>. If at any point the algorithm
+ not a <a href="#valid5">valid datetime</a>. If at any point the algorithm
says that it "fails", this means that it returns nothing.
<ol>
@@ -4705,7 +4006,7 @@
<p>Return <var title="">time</var> and <var title="">timezone</var>.
</ol>
- <h5 id=vaguer><span class=secno>2.5.4.2. </span>Vaguer moments in time</h5>
+ <h5 id=vaguer><span class=secno>2.4.4.2. </span>Vaguer moments in time</h5>
<p>This section defines <dfn id=date-or title="date or time string">date or
time strings</dfn>. There are two kinds, <dfn id=date-or0 title="date or
@@ -5087,14 +4388,14 @@
<p>Abort these steps (the string is parsed).
</ol>
- <h4 id=time-offsets><span class=secno>2.5.5 </span>Time offsets</h4>
+ <h4 id=time-offsets><span class=secno>2.4.5 </span>Time offsets</h4>
- <p class=big-issue><dfn id=valid7>valid time offset</dfn>, <dfn
+ <p class=big-issue><dfn id=valid6>valid time offset</dfn>, <dfn
id=rules4>rules for parsing time offsets</dfn>, <dfn id=time-offset>time
offset serialization rules</dfn>; in the format "5d4h3m2s1ms" or "3m 9.2s"
or "00:00:00.00" or similar.
- <h4 id=tokens><span class=secno>2.5.6 </span>Tokens</h4>
+ <h4 id=tokens><span class=secno>2.4.6 </span>Tokens</h4>
<p>A <dfn id=set-of>set of space-separated tokens</dfn> is a set of zero or
more words separated by one or more <a href="#space" title="space
@@ -5238,7 +4539,7 @@
to a single space, except at the start and end of the string, where such
spaces are removed.
- <h4 id=keywords><span class=secno>2.5.7 </span>Keywords and enumerated
+ <h4 id=keywords><span class=secno>2.4.7 </span>Keywords and enumerated
attributes</h4>
<p>Some attributes are defined as taking one of a finite set of keywords.
@@ -5282,9 +4583,9 @@
<em>missing value default</em>), but for various reasons that isn't the
way this specification actually defines it.
- <h4 id=syntax-references><span class=secno>2.5.8 </span>References</h4>
+ <h4 id=syntax-references><span class=secno>2.4.8 </span>References</h4>
- <p>A <dfn id=valid8>valid hash-name reference</dfn> to an element of type
+ <p>A <dfn id=valid7>valid hash-name reference</dfn> to an element of type
<var title="">type</var> is a string consisting of a U+0023 NUMBER SIGN
(<code title="">#</code>) character followed by a string which exactly
matches the value of the <code title="">name</code> attribute of an
@@ -5320,606 +4621,707 @@
-->
</ol>
- <h3 id=common2><span class=secno>2.6 </span>Common DOM interfaces</h3>
+ <h3 id=urls><span class=secno>2.5 </span>URLs</h3>
- <h4 id=reflecting><span class=secno>2.6.1 </span>Reflecting content
- attributes in DOM attributes</h4>
+ <p>This specification defines the term <a href="#url">URL</a>, and defines
+ various algorithms for dealing with URLs, because for historical reasons
+ the rules defined by the URI and IRI specifications are not a complete
+ description of what HTML user agents need to implement to be compatible
+ with Web content.
- <p>Some <span title="DOM attribute">DOM attributes</span> are defined to
- <dfn id=reflect>reflect</dfn> a particular <span>content attribute</span>.
- This means that on getting, the DOM attribute returns the current value of
- the content attribute, and on setting, the DOM attribute changes the value
- of the content attribute to the given value.
+ <h4 id=terminology0><span class=secno>2.5.1 </span>Terminology</h4>
- <p>If a reflecting DOM attribute is a <code>DOMString</code> attribute
- whose content attribute is defined to contain a <a href="#url">URL</a>,
- then on getting, the DOM attribute must <a href="#resolve" title="resolve
- a url">resolve</a> the value of the content attribute and return the
- resulting <a href="#absolute">absolute URL</a> if that was successful, or
- the empty string otherwise; and on setting, must set the content attribute
- to the specified literal value. If the content attribute is absent, the
- DOM attribute must return the default value, if the content attribute has
- one, or else the empty string.
+ <p>A <dfn id=url>URL</dfn> is a string used to identify a resource. <span
+ id=urldoc>A <a href="#url">URL</a> is always associated with a
+ <code>Document</code>, either explicitly when the URL is created or
+ defined; or through a DOM node, in which case the associated
+ <code>Document</code> is the node's <code>Document</code>; or through a
+ script, in which case the associated <code>Document</code> is the script's
+ <a href="#script4">script document context</a>.</span>
- <p>If a reflecting DOM attribute is a <code>DOMString</code> attribute
- whose content attribute is defined to contain one or more <a href="#url"
- title=URL>URLs</a>, then on getting, the DOM attribute must <span
- title="split the string on spaces">split the content attribute on
- spaces</span> and return the concatenation of <a href="#resolve"
- title="resolve a URL">resolving</a> each token URL to an <a
- href="#absolute">absolute URL</a>, with a single U+0020 SPACE character
- between each URL, ignoring any tokens that did not resolve successfully.
- If the content attribute is absent, the DOM attribute must return the
- default value, if the content attribute has one, or else the empty string.
- On setting, the DOM attribute must set the content attribute to the
- specified literal value.
+ <p>A <a href="#url">URL</a> is a <dfn id=valid8>valid URL</dfn> if at least
+ one of the following conditions holds:
- <p>If a reflecting DOM attribute is a <code>DOMString</code> whose content
- attribute is an <a href="#enumerated">enumerated attribute</a>, and the
- DOM attribute is <dfn id=limited>limited to only known values</dfn>, then,
- on getting, the DOM attribute must return the conforming value associated
- with the state the attribute is in (in its canonical case), or the empty
- string if the attribute is in a state that has no associated keyword
- value; and on setting, if the new value is an <a href="#ascii">ASCII
- case-insensitive</a> match for one of the keywords given for that
- attribute, then the content attribute must be set to the conforming value
- associated with the state that the attribute would be in if set to the
- given new value, otherwise, if the new value is the empty string, then the
- content attribute must be removed, otherwise, the setter must raise a
- <code>SYNTAX_ERR</code> exception.
+ <ul>
+ <li>
+ <p>The <a href="#url">URL</a> is a valid URI reference <a
+ href="#refsRFC3986">[RFC3986]</a>.
- <p>If a reflecting DOM attribute is a <code>DOMString</code> but doesn't
- fall into any of the above categories, then the getting and setting must
- be done in a transparent, case-preserving manner.
+ <li>
+ <p>The <a href="#url">URL</a> is a valid IRI reference and it has no
+ query component. <a href="#refsRFC3987">[RFC3987]</a>
- <p>If a reflecting DOM attribute is a boolean attribute, then on getting
- the DOM attribute must return true if the attribute is set, and false if
- it is absent. On setting, the content attribute must be removed if the DOM
- attribute is set to false, and must be set to have the same value as its
- name if the DOM attribute is set to true. (This corresponds to the rules
- for <a href="#boolean0" title="boolean attribute">boolean content
- attributes</a>.)
+ <li>
+ <p>The <a href="#url">URL</a> is a valid IRI reference and its query
+ component contains no unescaped non-ASCII characters. <a
+ href="#refsRFC3987">[RFC3987]</a>
- <p>If a reflecting DOM attribute is a signed integer type
- (<code>long</code>) then, on getting, the content attribute must be parsed
- according to <a href="#rules0" title="rules for parsing integers">the
- rules for parsing signed integers</a>, and if that is successful, the
- resulting value must be returned. If, on the other hand, it fails, or if
- the attribute is absent, then the default value must be returned instead,
- or 0 if there is no default value. On setting, the given value must be
- converted to the shortest possible string representing the number as a <a
- href="#valid1">valid integer</a> in base ten and then that string must be
- used as the new content attribute value.
+ <li>
+ <p>The <a href="#url">URL</a> is a valid IRI reference and the <a
+ href="#character3" title="document's character encoding">character
+ encoding</a> of the URL's <code>Document</code> is UTF-8 or UTF-16. <a
+ href="#refsRFC3987">[RFC3987]</a>
+ </ul>
- <p>If a reflecting DOM attribute is an <em>unsigned</em> integer type
- (<code>unsigned long</code>) then, on getting, the content attribute must
- be parsed according to <a href="#rules" title="rules for parsing
- non-negative integers">the rules for parsing unsigned integers</a>, and if
- that is successful, the resulting value must be returned. If, on the other
- hand, it fails, or if the attribute is absent, the default value must be
- returned instead, or 0 if there is no default value. On setting, the given
- value must be converted to the shortest possible string representing the
- number as a <a href="#valid0">valid non-negative integer</a> in base ten
- and then that string must be used as the new content attribute value.
+ <p class=note>The term "URL" in this specification is used in a manner
+ distinct from the precise technical meaning it is given in RFC 3986.
+ Readers familiar with that RFC will find it easier to read <em>this</em>
+ specification if they pretend the term "URL" as used herein is really
+ called something else altogether.
- <p>If a reflecting DOM attribute is an unsigned integer type
- (<code>unsigned long</code>) that is <dfn id=limited0>limited to only
- positive non-zero numbers</dfn>, then the behavior is similar to the
- previous case, but zero is not allowed. On getting, the content attribute
- must first be parsed according to <a href="#rules" title="rules for
- parsing non-negative integers">the rules for parsing unsigned
- integers</a>, and if that is successful, the resulting value must be
- returned. If, on the other hand, it fails, or if the attribute is absent,
- the default value must be returned instead, or 1 if there is no default
- value. On setting, if the value is zero, the user agent must fire an
- <code>INDEX_SIZE_ERR</code> exception. Otherwise, the given value must be
- converted to the shortest possible string representing the number as a <a
- href="#valid0">valid non-negative integer</a> in base ten and then that
- string must be used as the new content attribute value.
+ <h4 id=parsing0><span class=secno>2.5.2 </span>Parsing URLs</h4>
- <p>If a reflecting DOM attribute is a floating point number type
- (<code>float</code>) and the content attribute is defined to contain a
- time offset, then, on getting, the content attribute must be parsed
- according to <a href="#rules4" title="rules for parsing time offsets">the
- rules for parsing time offsets</a>, and if that is successful, the
- resulting value, in seconds, must be returned. If that fails, or if the
- attribute is absent, the default value must be returned, or the
- not-a-number value (NaN) if there is no default value. On setting, the
- given value, interpreted as a time offset in seconds, must be converted to
- a string using the <a href="#time-offset">time offset serialization
- rules</a>, and that string must be used as the new content attribute
- value.
+ <p>To <dfn id=parse0>parse a URL</dfn> <var title="">url</var> into its
+ component parts, the user agent must use the following steps:
- <p>If a reflecting DOM attribute is a floating point number type
- (<code>float</code>) and it doesn't fall into one of the earlier
- categories, then, on getting, the content attribute must be parsed
- according to <a href="#rules1" title="rules for parsing floating point
- number values">the rules for parsing floating point number values</a>, and
- if that is successful, the resulting value must be returned. If, on the
- other hand, it fails, or if the attribute is absent, the default value
- must be returned instead, or 0.0 if there is no default value. On setting,
- the given value must be converted to the shortest possible string
- representing the number as a <a href="#valid2">valid floating point
- number</a> in base ten and then that string must be used as the new
- content attribute value.
+ <ol>
+ <li>
+ <p>Strip leading and trailing <a href="#space" title="space
+ character">space characters</a> from <var title="">url</var>.
- <p>If a reflecting DOM attribute is of the type <code><a
- href="#domtokenlist0">DOMTokenList</a></code>, then on getting it must
- return a <code><a href="#domtokenlist0">DOMTokenList</a></code> object
- whose underlying string is the element's corresponding content attribute.
- When the <code><a href="#domtokenlist0">DOMTokenList</a></code> object
- mutates its underlying string, the content attribute must itself be
- immediately mutated. When the attribute is absent, then the string
- represented by the <code><a href="#domtokenlist0">DOMTokenList</a></code>
- object is the empty string; when the object mutates this empty string, the
- user agent must first add the corresponding content attribute, and then
- mutate that attribute instead. <code><a
- href="#domtokenlist0">DOMTokenList</a></code> attributes are always
- read-only. The same <code><a href="#domtokenlist0">DOMTokenList</a></code>
- object must be returned every time for each attribute.
+ <li>
+ <p>Parse <var title="">url</var> in the manner defined by RFC 3986, with
+ the following exceptions:</p>
- <p>If a reflecting DOM attribute has the type <code><a
- href="#htmlelement">HTMLElement</a></code>, or an interface that descends
- from <code><a href="#htmlelement">HTMLElement</a></code>, then, on
- getting, it must run the following algorithm (stopping at the first point
- where a value is returned):
+ <ul>
+ <li>Add all characters with codepoints less than or equal to U+0020 or
+ greater than or equal to U+007F to the <unreserved> production.
- <ol>
- <li>If the corresponding content attribute is absent, then the DOM
- attribute must return null.
+ <li>Add the characters U+0022, U+003C, U+003E, U+005B .. U+005E, U+0060,
+ and U+007B .. U+007D to the <unreserved> production. <!--
+ 0022 QUOTATION MARK
+ 003C LESS-THAN SIGN
+ 003E GREATER-THAN SIGN
+ 005B LEFT SQUARE BRACKET
+ 005C REVERSE SOLIDUS
+ 005D RIGHT SQUARE BRACKET
+ 005E CIRCUMFLEX ACCENT
+ 0060 GRAVE ACCENT
+ 007B LEFT CURLY BRACKET
+ 007C VERTICAL LINE
+ 007D RIGHT CURLY BRACKET
+ -->
+
- <li>Let <var title="">candidate</var> be the element that the <code
- title="">document.getElementById()</code> method would find if it was
- passed as its argument the current value of the corresponding content
- attribute.
+ <li>Add a single U+0025 PERCENT SIGN character as a second alternative
+ way of matching the <pct-encoded> production, except when the
+ <pct-encoded> is used in the <reg-name> production.
- <li>If <var title="">candidate</var> is null, or if it is not
- type-compatible with the DOM attribute, then the DOM attribute must
- return null.
+ <li>Add the U+0023 NUMBER SIGN character to the characters allowed in
+ the <fragment> production.</li>
+ <!-- some browsers also have other differences, e.g. Mozilla
+ seems to treat ";" as if it was not in sub-delims, if the scheem
+ is "ftp". -->
+ </ul>
- <li>Otherwise, it must return <var title="">candidate</var>.
- </ol>
+ <li>
+ <p>If <var title="">url</var> doesn't match the <URI-reference>
+ production, even after the above changes are made to the ABNF
+ definitions, then parsing the URL fails with an error. <a
+ href="#refsRFC3986">[RFC3986]</a></p>
- <p>On setting, if the given element has an <code title=attr-id><a
- href="#id">id</a></code> attribute, then the content attribute must be set
- to the value of that <code title=attr-id><a href="#id">id</a></code>
- attribute. Otherwise, the DOM attribute must be set to the empty string.</p>
- <!-- XXX or raise an exception? -->
+ <p>Otherwise, parsing <var title="">url</var> was successful; the
+ components of the URL are substrings of <var title="">url</var> defined
+ as follows:</p>
- <h4 id=collections><span class=secno>2.6.2 </span>Collections</h4>
+ <dl>
+ <dt><dfn id=ltschemegt title=url-scheme><scheme></dfn>
- <p>The <code><a href="#htmlcollection0">HTMLCollection</a></code>, <code><a
- href="#htmlformcontrolscollection0">HTMLFormControlsCollection</a></code>,
- and <code><a
- href="#htmloptionscollection0">HTMLOptionsCollection</a></code> interfaces
- represent various lists of DOM nodes. Collectively, objects implementing
- these interfaces are called <dfn id=collections0>collections</dfn>.
+ <dd>
+ <p>The substring matched by the <scheme> production, if any.
- <p>When a <a href="#collections0" title=collections>collection</a> is
- created, a filter and a root are associated with the collection.
+ <dt><dfn id=lthostgt title=url-host><host></dfn>
- <p class=example>For example, when the <code><a
- href="#htmlcollection0">HTMLCollection</a></code> object for the <code
- title=dom-document-images><a href="#images0">document.images</a></code>
- attribute is created, it is associated with a filter that selects only
- <code><a href="#img">img</a></code> elements, and rooted at the root of
- the document.
+ <dd>
+ <p>The substring matched by the <host> production, if any.
- <p>The <a href="#collections0" title=collections>collection</a> then <dfn
- id=represents title="represented by the collection">represents</dfn> a <a
- href="#live">live</a> view of the subtree rooted at the collection's root,
- containing only nodes that match the given filter. The view is linear. In
- the absence of specific requirements to the contrary, the nodes within the
- collection must be sorted in <a href="#tree-order">tree order</a>.
+ <dt><dfn id=ltportgt title=url-port><port></dfn>
- <p class=note>The <code title=dom-table-rows><a
- href="#rows">rows</a></code> list is not in tree order.
+ <dd>
+ <p>The substring matched by the <port> production, if any.
- <p>An attribute that returns a collection must return the same object every
- time it is retrieved.
+ <dt><dfn id=lthostportgt title=url-hostport><hostport></dfn>
- <h5 id=htmlcollection><span class=secno>2.6.2.1. </span>HTMLCollection</h5>
+ <dd>
+ <p>If there is a <scheme> component and a <port> component
+ and the port given by the <port> component is different than the
+ default port defined for the protocol given by the <scheme>
+ component, then <hostport> is the substring that starts with the
+ substring matched by the <host> production and ends with the
+ substring matched by the <port> production, and includes the
+ colon in between the two. Otherwise, it is the same as the
+ <host> component.</p>
- <p>The <code><a href="#htmlcollection0">HTMLCollection</a></code> interface
- represents a generic <a href="#collections0"
- title=collections>collection</a> of elements.
+ <dt><dfn id=ltpathgt title=url-path><path></dfn>
- <pre class=idl>interface <dfn id=htmlcollection0>HTMLCollection</dfn> {
- readonly attribute unsigned long <a href="#length" title=dom-HTMLCollection-length>length</a>;
- [IndexGetter] Element <a href="#itemindex" title=dom-HTMLCollection-item>item</a>(in unsigned long index);
- [NameGetter] Element <a href="#nameditem" title=dom-HTMLCollection-namedItem>namedItem</a>(in DOMString name);
-};</pre>
+ <dd>
+ <p>The substring matched by one of the following productions, if one of
+ them was matched:</p>
- <p>The <dfn id=length
- title=dom-HTMLCollection-length><code>length</code></dfn> attribute must
- return the number of nodes <a href="#represents">represented by the
- collection</a>.
+ <ul class=brief>
+ <li><path-abempty>
- <p>The <dfn id=itemindex title=dom-HTMLCollection-item><code>item(<var
- title="">index</var>)</code></dfn> method must return the <var
- title="">index</var>th node in the collection. If there is no <var
- title="">index</var>th node in the collection, then the method must return
- null.
+ <li><path-absolute>
- <p>The <dfn id=nameditem
- title=dom-HTMLCollection-namedItem><code>namedItem(<var
- title="">key</var>)</code></dfn> method must return the first node in the
- collection that matches the following requirements:
+ <li><path-noscheme>
- <ul>
- <li>It is an <code><a href="#a">a</a></code>, <code><a
- href="#applet">applet</a></code>, <code><a href="#area">area</a></code>,
- <code>form</code>, <code><a href="#img">img</a></code>, or <code><a
- href="#object">object</a></code> element with a <code
- title=attr-name>name</code> attribute equal to <var title="">key</var>,
- or,
+ <li><path-rootless>
- <li>It is an <a href="#html-elements" title="HTML elements">HTML
- element</a> of any kind with an <code title=attr-id><a
- href="#id">id</a></code> attribute equal to <var title="">key</var>.
- (Non-HTML elements, even if they have IDs, are not searched for the
- purposes of <code title=dom-HTMLCollection-namedItem><a
- href="#nameditem">namedItem()</a></code>.)
- </ul>
+ <li><path-empty>
+ </ul>
- <p>If no such elements are found, then the method must return null.
+ <dt><dfn id=ltquerygt title=url-query><query></dfn>
- <h5 id=htmlformcontrolscollection><span class=secno>2.6.2.2.
- </span>HTMLFormControlsCollection</h5>
+ <dd>
+ <p>The substring matched by the <query> production, if any.
- <p>The <code><a
- href="#htmlformcontrolscollection0">HTMLFormControlsCollection</a></code>
- interface represents a <a href="#collections0"
- title=collections>collection</a> of form controls.
+ <dt><dfn id=ltfragmentgt title=url-fragment><fragment></dfn>
- <pre
- class=idl>interface <dfn id=htmlformcontrolscollection0>HTMLFormControlsCollection</dfn> {
- readonly attribute unsigned long <a href="#length0" title=dom-HTMLFormControlsCollection-length>length</a>;
- [IndexGetter] <a href="#htmlelement">HTMLElement</a> <a href="#itemindex0" title=dom-HTMLFormControlsCollection-item>item</a>(in unsigned long index);
- [NameGetter] Object <a href="#nameditem0" title=dom-HTMLFormControlsCollection-namedItem>namedItem</a>(in DOMString name);
-};</pre>
+ <dd>
+ <p>The substring matched by the <fragment> production, if any.
+ </dl>
+ </ol>
+ <!-- XXX we might want to define "server-based naming authority",
+ it's not clear RFC3986 does a good job of defining that anymore
+ (earlier URI specs did) -->
- <p>The <dfn id=length0
- title=dom-HTMLFormControlsCollection-length><code>length</code></dfn>
- attribute must return the number of nodes <a
- href="#represents">represented by the collection</a>.
+ <h4 id=resolving><span class=secno>2.5.3 </span>Resolving URLs</h4>
- <p>The <dfn id=itemindex0
- title=dom-HTMLFormControlsCollection-item><code>item(<var
- title="">index</var>)</code></dfn> method must return the <var
- title="">index</var>th node in the collection. If there is no <var
- title="">index</var>th node in the collection, then the method must return
- null.
+ <p>Relative URLs are resolved relative to a base URL. The <dfn
+ id=base->base URL</dfn> of a <a href="#url">URL</a> is the <a
+ href="#absolute">absolute URL</a> obtained as follows:
- <p>The <dfn id=nameditem0
- title=dom-HTMLFormControlsCollection-namedItem><code>namedItem(<var
- title="">key</var>)</code></dfn> method must act according to the
- following algorithm:
+ <dl class=switch>
+ <dt>If the URL to be resolved was passed to an API
+ <dd>
+ <p>The base URL is the <a href="#document0">document base URL</a> of the
+ script's <a href="#script4">script document context</a>.
+
+ <dt>If the URL to be resolved is from the value of a content attribute
+
+ <dd>
+ <p>The base URL is the <i>base URI of the element</i> that the attribute
+ is on, as defined by the XML Base specification, with <i>the base URI of
+ the document entity</i> being defined as the <a
+ href="#document0">document base URL</a> of the <code>Document</code>
+ that owns the element.</p>
+
+ <p>For the purposes of the XML Base specification, user agents must act
+ as if all <code>Document</code> objects represented XML documents.</p>
+
+ <p class=note>It is possible for <code title=attr-xml-base><a
+ href="#xmlbase">xml:base</a></code> attributes to be present even in
+ HTML fragments, as such attributes can be added dynamically using
+ script. (Such scripts would not be conforming, however, as <code
+ title=attr-xml-base><a href="#xmlbase">xml:base</a></code> attributes
+ are not allowed in <a href="#html-">HTML documents</a>.)</p>
+
+ <dt>If the URL to be resolved was found in an offline application cache
+ manifest
+
+ <dd>
+ <p>The base URL is the URL of the <a href="#application0">application
+ cache</a> <a href="#the-manifest"
+ title=concept-appcache-manifest>manifest</a>.
+ </dl>
+
+ <p>The <dfn id=document0>document base URL</dfn> of a <code>Document</code>
+ is the <a href="#absolute">absolute URL</a> obtained by running these
+ steps:
+
<ol>
- <li>If, at the time the method is called, there is exactly one node in the
- collection that has either an <code title=attr-id><a
- href="#id">id</a></code> attribute or a <code title=attr-name>name</code>
- attribute equal to <var title="">key</var>, then return that node and
- stop the algorithm.
+ <li>
+ <p>If there is no <code><a href="#base">base</a></code> element that is
+ both a child of <a href="#the-head0">the <code>head</code> element</a>
+ and has an <code title=attr-base-href><a href="#href">href</a></code>
+ attribute, then the <a href="#document0">document base URL</a> is
+ <span>the document's address</span><!-- XXXDOCURL -->.
- <li>Otherwise, if there are no nodes in the collection that have either an
- <code title=attr-id><a href="#id">id</a></code> attribute or a <code
- title=attr-name>name</code> attribute equal to <var title="">key</var>,
- then return null and stop the algorithm.
+ <li>
+ <p>Otherwise, let <var title="">url</var> be the value of the <code
+ title=attr-base-href><a href="#href">href</a></code> attribute of the
+ first such element.
- <li>Otherwise, create a <code>NodeList</code> object representing a live
- view of the <code><a
- href="#htmlformcontrolscollection0">HTMLFormControlsCollection</a></code>
- object, further filtered so that the only nodes in the
- <code>NodeList</code> object are those that have either an <code
- title=attr-id><a href="#id">id</a></code> attribute or a <code
- title=attr-name>name</code> attribute equal to <var title="">key</var>.
- The nodes in the <code>NodeList</code> object must be sorted in <a
- href="#tree-order">tree order</a>.
+ <li>
+ <p><a href="#resolve" title="resolve a URL">Resolve</a> the <var
+ title="">url</var> URL, using <span>the document's
+ address</span><!-- XXXDOCURL --> as the <a href="#base-">base URL</a>
+ (thus, the <code><a href="#base">base</a></code> <code
+ title=attr-base-href><a href="#href">href</a></code> attribute isn't
+ affect by <code title=attr-xml-base><a
+ href="#xmlbase">xml:base</a></code> attributes).
- <li>Return that <code>NodeList</code> object.
+ <li>
+ <p>The <a href="#document0">document base URL</a> is the result of the
+ previous step if it was successful; otherwise it is <span>the document's
+ address</span><!-- XXXDOCURL -->.
</ol>
- <!--
-http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E...%0A%3Cform%20name%3D%22a%22%3E%3Cinput%20id%3D%22x%22%20name%3D%22y%22%3E%3Cinput%20name%3D%22x%22%20id%3D%22y%22%3E%3C/form%3E%0A%3Cscript%3E%0A%20%20var%20x%3B%0A%20%20w%28x%20%3D%20document.forms%5B%27a%27%5D%5B%27x%27%5D%29%3B%0A%20%20w%28x.length%29%3B%0A%20%20x%5B0%5D.parentNode.removeChild%28x%5B0%5D%29%3B%0A%20%20w%28x.length%29%3B%0A%20%20w%28x%20%3D%3D%20document.forms%5B%27a%27%5D%5B%27x%27%5D%29%3B%0A%3C/script%3E%0A
--->
- <h5 id=htmloptionscollection><span class=secno>2.6.2.3.
- </span>HTMLOptionsCollection</h5>
+ <p>To <dfn id=resolve>resolve a URL</dfn> to an <a
+ href="#absolute">absolute URL</a> the user agent must use the following
+ steps. Resolving a URL can result in an error, in which case the URL is
+ not resolvable.
- <p>The <code><a
- href="#htmloptionscollection0">HTMLOptionsCollection</a></code> interface
- represents a list of <code>option</code> elements.
+ <ol>
+ <li>
+ <p>Let <var title="">url</var> be the <a href="#url">URL</a> being
+ resolved.
- <pre
- class=idl>interface <dfn id=htmloptionscollection0>HTMLOptionsCollection</dfn> {
- attribute unsigned long <a href="#length1" title=dom-HTMLOptionsCollection-length>length</a>;
- [IndexGetter] HTMLOptionElement <a href="#itemindex1" title=dom-HTMLOptionsCollection-item>item</a>(in unsigned long index);
- [NameGetter] Object <a href="#nameditem1" title=dom-HTMLOptionsCollection-namedItem>namedItem</a>(in DOMString name);
-};</pre>
+ <li>
+ <p>Let <var title="">document</var> be the <code>Document</code> <a
+ href="#urldoc">associated with</a> <var title="">url</var>.
- <p>On getting, the <dfn id=length1
- title=dom-HTMLOptionsCollection-length><code>length</code></dfn> attribute
- must return the number of nodes <a href="#represents">represented by the
- collection</a>.
+ <li>
+ <p>Let <var title="">encoding</var> be the <a href="#character3"
+ title="document's character encoding">character encoding</a> of <var
+ title="">document</var>.
- <p>On setting, the behavior depends on whether the new value is equal to,
- greater than, or less than the number of nodes <a
- href="#represents">represented by the collection</a> at that time. If the
- number is the same, then setting the attribute must do nothing. If the new
- value is greater, then <var title="">n</var> new <code>option</code>
- elements with no attributes and no child nodes must be appended to the
- <code>select</code> element on which the <code><a
- href="#htmloptionscollection0">HTMLOptionsCollection</a></code> is rooted,
- where <var title="">n</var> is the difference between the two numbers (new
- value minus old value). If the new value is lower, then the last <var
- title="">n</var> nodes in the collection must be removed from their parent
- nodes, where <var title="">n</var> is the difference between the two
- numbers (old value minus new value).
+ <li>
+ <p>If <var title="">encoding</var> is UTF-16, then change it to UTF-8.
- <p class=note>Setting <code title=dom-HTMLOptionsCollection-length><a
- href="#length1">length</a></code> never removes or adds any
- <code>optgroup</code> elements, and never adds new children to existing
- <code>optgroup</code> elements (though it can remove children from them).
+ <li>
+ <p>Let <var title="">base</var> be the <a href="#base-">base URL</a> for
+ <var title="">url</var>. (This is an <a href="#absolute">absolute
+ URL</a>.)
- <p>The <dfn id=itemindex1
- title=dom-HTMLOptionsCollection-item><code>item(<var
- title="">index</var>)</code></dfn> method must return the <var
- title="">index</var>th node in the collection. If there is no <var
- title="">index</var>th node in the collection, then the method must return
- null.
+ <li>
+ <p><a href="#parse0" title="parse a URL">Parse</a> <var
+ title="">url</var> into its component parts.
- <p>The <dfn id=nameditem1
- title=dom-HTMLOptionsCollection-namedItem><code>namedItem(<var
- title="">key</var>)</code></dfn> method must act according to the
- following algorithm:
+ <li>
+ <p>If parsing <var title="">url</var> resulted in a <a href="#lthostgt"
+ title=url-host><host></a> component, then replace the matching
+ subtring of <var title="">url</var> with the string that results from
+ expanding any sequences of percent-encoded octets in that component that
+ are valid UTF-8 sequences into Unicode characters as defined by UTF-8.</p>
- <ol>
- <li>If, at the time the method is called, there is exactly one node in the
- collection that has either an <code title=attr-id><a
- href="#id">id</a></code> attribute or a <code title=attr-name>name</code>
- attribute equal to <var title="">key</var>, then return that node and
- stop the algorithm.
+ <p>If any percent-encoded octets in that component are not valid UTF-8
+ sequences, then return an error and abort these steps.</p>
- <li>Otherwise, if there are no nodes in the collection that have either an
- <code title=attr-id><a href="#id">id</a></code> attribute or a <code
- title=attr-name>name</code> attribute equal to <var title="">key</var>,
- then return null and stop the algorithm.
+ <p>Apply the IDNA ToASCII algorithm to the matching substring, with both
+ the AllowUnassigned and UseSTD3ASCIIRules flags set. Replace the
+ matching substring with the result of the ToASCII algorithm.</p>
- <li>Otherwise, create a <code>NodeList</code> object representing a live
- view of the <code><a
- href="#htmloptionscollection0">HTMLOptionsCollection</a></code> object,
- further filtered so that the only nodes in the <code>NodeList</code>
- object are those that have either an <code title=attr-id><a
- href="#id">id</a></code> attribute or a <code
- title=attr-option-name>name</code> attribute equal to <var
- title="">key</var>. The nodes in the <code>NodeList</code> object must be
- sorted in <a href="#tree-order">tree order</a>.
+ <p>If ToASCII fails to convert one of the components of the string, e.g.
+ because it is too long or because it contains invalid characters, then
+ return an error and abort these steps. <a
+ href="#refsRFC3490">[RFC3490]</a></p>
- <li>Return that <code>NodeList</code> object.
- </ol>
- <!-- see also http://ln.hixie.ch/?start=1161042744&count=1 -->
+ <li>
+ <p>If parsing <var title="">url</var> resulted in a <a href="#ltpathgt"
+ title=url-path><path></a> component, then replace the matching
+ substring of <var title="">url</var> with the string that results from
+ applying the following steps to each character other than U+0025 PERCENT
+ SIGN (%) that doesn't match the original <path> production defined
+ in RFC 3986:</p>
- <p class=big-issue>We may want to add <code>add()</code> and
- <code>remove()</code> methods here too because IE implements
- HTMLSelectElement and HTMLOptionsCollection on the same object, and so
- people use them almost interchangeably in the wild.
+ <ol>
+ <li>Encode the character into a sequence of octets as defined by UTF-8.
- <h4 id=domtokenlist><span class=secno>2.6.3 </span>DOMTokenList</h4>
+ <li>Replace the character with the percent-encoded form of those octets.
+ <a href="#refsRFC3986">[RFC3986]</a>
+ </ol>
- <p>The <code><a href="#domtokenlist0">DOMTokenList</a></code> interface
- represents an interface to an underlying string that consists of an <a
- href="#unordered">unordered set of unique space-separated tokens</a>.
+ <div class=example>
+ <p>For instance if <var title="">url</var> was "<code
+ title="">//example.com/a^b☺c%FFd%z/?e</code>", then the <a
+ href="#ltpathgt" title=url-path><path></a> component's substring
+ would be "<code title="">/a^b☺c%FFd%z/</code>" and the two
+ characters that would have to be escaped would be "<code
+ title="">^</code>" and "<code title="">☺</code>". The result
+ after this step was applied would therefore be that <var
+ title="">url</var> now had the value "<code
+ title="">//example.com/a%5Eb%E2%98%BAc%FFd%z/?e</code>".</p>
+ </div>
- <p>Which string underlies a particular <code><a
- href="#domtokenlist0">DOMTokenList</a></code> object is defined when the
- object is created. It might be a content attribute (e.g. the string that
- underlies the <code title=dom-classList><a
- href="#classlist">classList</a></code> object is the <code
- title=attr-class><a href="#class">class</a></code> attribute), or it might
- be an anonymous string (e.g. when a <code><a
- href="#domtokenlist0">DOMTokenList</a></code> object is passed to an
- author-implemented callback in the <code><a
- href="#datagrid0">datagrid</a></code> APIs).
+ <li>
+ <p>If parsing <var title="">url</var> resulted in a <a href="#ltquerygt"
+ title=url-query><query></a> component, then replace the matching
+ substring of <var title="">url</var> with the string that results from
+ applying the following steps to each character other than U+0025 PERCENT
+ SIGN (%) that doesn't match the original <query> production
+ defined in RFC 3986:</p>
- <pre
- class=idl>[<a href="#stringify" title=dom-tokenlist-toString>Stringifies</a>] interface <dfn id=domtokenlist0>DOMTokenList</dfn> {
- readonly attribute unsigned long <a href="#length2" title=dom-tokenlist-length>length</a>;
- [IndexGetter] DOMString <a href="#itemindex2" title=dom-tokenlist-item>item</a>(in unsigned long index);
- boolean <a href="#hastoken" title=dom-tokenlist-has>has</a>(in DOMString token);
- void <a href="#addtoken" title=dom-tokenlist-add>add</a>(in DOMString token);
- void <a href="#remove0" title=dom-tokenlist-remove>remove</a>(in DOMString token);
- boolean <a href="#toggle" title=dom-tokenlist-toggle>toggle</a>(in DOMString token);
-};</pre>
+ <ol>
+ <li>If the character in question cannot be expressed in the encoding
+ <var title="">encoding</var>, then replace it with a single 0x3F octet
+ (an ASCII question mark) and skip the remaining substeps for this
+ character.
- <p>The <dfn id=length2 title=dom-tokenlist-length><code>length</code></dfn>
- attribute must return the number of <em>unique</em> tokens that result
- from <a href="#split" title="split a string on spaces">splitting the
- underlying string on spaces</a>.
+ <li>Encode the character into a sequence of octets as defined by the
+ encoding <var title="">encoding</var>.
- <p>The <dfn id=itemindex2 title=dom-tokenlist-item><code>item(<var
- title="">index</var>)</code></dfn> method must <a href="#split"
- title="split a string on spaces">split the underlying string on
- spaces</a>, sort the resulting list of tokens by Unicode
- codepoint<!-- XXX that's
- basically nonsense. What sort order do we want here? It should be
- the cheapest one possible that is well-defined for all Unicode. -->,
- remove exact duplicates, and then return the <var title="">index</var>th
- item in this list. If <var title="">index</var> is equal to or greater
- than the number of tokens, then the method must return null.
+ <li>Replace the character with the percent-encoded form of those octets.
+ <a href="#refsRFC3986">[RFC3986]</a>
+ </ol>
- <p>The <dfn id=hastoken title=dom-tokenlist-has><code>has(<var
- title="">token</var>)</code></dfn> method must run the following
- algorithm:
+ <li>
+ <p>Apply the algorithm described in RFC 3986 section 5.2 Relative
+ Resolution, using <var title="">url</var> as the potentially relative
+ URI reference (<var title="">R</var>), and <var title="">base</var> as
+ the base URI (<var title="">Base</var>). <a
+ href="#refsRFC3986">[RFC3986]</a>
- <ol>
- <li>If the <var title="">token</var> argument contains any <a
- href="#space" title="space character">space characters</a>, then raise an
- <code>INVALID_CHARACTER_ERR</code> exception and stop the algorithm.
+ <li>
+ <p>Apply any relevant conformance criteria of RFC 3986 and RFC 3987,
+ returning an error and aborting these steps if appropriate. <a
+ href="#refsRFC3986">[RFC3986]</a> <a href="#refsRFC3987">[RFC3987]</a></p>
- <li>Otherwise, <a href="#split" title="split a string on spaces">split the
- underlying string on spaces</a> to get the list of tokens in the object's
- underlying string.
+ <p class=example>For instance, if an absolute URI that would be returned
+ by the above algorithm violates the restrictions specific to its scheme,
+ e.g. a <code title="">data:</code> URI using the "<code
+ title="">//</code>" server-based naming authority syntax, then user
+ agents are to treat this as an error instead.<!-- RFC
+ 3986, 3.1 Scheme --></p>
- <li>If the token indicated by <var title="">token</var> is one of the
- tokens in the object's underlying string then return true and stop this
- algorithm.
+ <li>
+ <p>Let <var title="">result</var> be the target URI (<var
+ title="">T</var>) returned by the Relative Resolution algorithm.
- <li>Otherwise, return false.
+ <li>
+ <p>If <var title="">result</var> uses a scheme with a server-based naming
+ authority, replace all U+005C REVERSE SOLIDUS (\) characters in <var
+ title="">result</var> with U+002F SOLIDUS (/) characters.
+
+ <li>
+ <p>Return <var title="">result</var>.
</ol>
- <p>The <dfn id=addtoken title=dom-tokenlist-add><code>add(<var
- title="">token</var>)</code></dfn> method must run the following
- algorithm:
+ <p>A <a href="#url">URL</a> is an <dfn id=absolute>absolute URL</dfn> if <a
+ href="#resolve" title="resolve a URL">resolving</a> it results in the same
+ URL without an error.
- <ol>
- <li>If the <var title="">token</var> argument contains any <a
- href="#space" title="space character">space characters</a>, then raise an
- <code>INVALID_CHARACTER_ERR</code> exception and stop the algorithm.
+ <h4 id=dynamic><span class=secno>2.5.4 </span>Dynamic changes to base URLs</h4>
- <li>Otherwise, <a href="#split" title="split a string on spaces">split the
- underlying string on spaces</a> to get the list of tokens in the object's
- underlying string.
+ <p>When an <code title=attr-xml-base><a href="#xmlbase">xml:base</a></code>
+ attribute changes, the attribute's element, and all descendant elements,
+ are <a href="#affected">affected by a base URL change</a>.
- <li>If the given <var title="">token</var> is already one of the tokens in
- the <code><a href="#domtokenlist0">DOMTokenList</a></code> object's
- underlying string then stop the algorithm.
+ <p>When a document's <a href="#document0">document base URL</a> changes,
+ all elements in that document are <a href="#affected">affected by a base
+ URL change</a>.
- <li>Otherwise, if the <code><a
- href="#domtokenlist0">DOMTokenList</a></code> object's underlying string
- is not the empty string and the last character of that string is not a <a
- href="#space">space character</a>, then append a U+0020 SPACE character
- to the end of that string.
+ <p>When an element is moved from one document to another, if the two
+ documents have different <a href="#document0" title="document base
+ URL">base URLs</a>, then that element and all its descendants are <a
+ href="#affected">affected by a base URL change</a>.
- <li>Append the value of <var title="">token</var> to the end of the
- <code><a href="#domtokenlist0">DOMTokenList</a></code> object's
- underlying string.
- </ol>
+ <p>When an element is <dfn id=affected>affected by a base URL change</dfn>,
+ it must act as described in the following list:
- <p>The <dfn id=remove0 title=dom-tokenlist-remove><code>remove(<var
- title="">token</var>)</code></dfn> method must run the following
- algorithm:
+ <dl class=switch>
+ <dt>If the element is a <a href="#hyperlinks" title=hyperlink>hyperlink
+ element</a>
- <ol>
- <li>If the <var title="">token</var> argument contains any <a
- href="#space" title="space character">space characters</a>, then raise an
- <code>INVALID_CHARACTER_ERR</code> exception and stop the algorithm.
+ <dd>
+ <p>If the <a href="#absolute">absolute URL</a> identified by the
+ hyperlink is being shown to the user, or if any data derived from that
+ URL is affecting the display, then the <code
+ title=attr-hyperlink-href><a href="#href6">href</a></code> attribute
+ should be <a href="#resolve" title="resolve a url">reresolved</a> and
+ the UI updated appropriately.</p>
- <li>Otherwise, <a href="#remove" title="remove a token from a
- string">remove the given <var title="">token</var> from the underlying
- string</a>.
- </ol>
+ <p class=example>For example, the CSS <code title="">:link</code>/<code
+ title="">:visited</code> pseudo-classes might have been affected.</p>
- <p>The <dfn id=toggle title=dom-tokenlist-toggle><code>toggle(<var
- title="">token</var>)</code></dfn> method must run the following
- algorithm:
+ <p>If the hyperlink has a <code title=attr-hyperlink-ping><a
+ href="#ping">ping</a></code> attribute and its <a href="#absolute"
+ title="absolute URL">absolute URL(s)</a> are being shown to the user,
+ then the <code title=attr-hyperlink-ping><a href="#ping">ping</a></code>
+ attribute's tokens should be <a href="#resolve" title="resolve a
+ url">reresolved</a> and the UI updated appropriately.</p>
- <ol>
- <li>If the <var title="">token</var> argument contains any <a
- href="#space" title="space character">space characters</a>, then raise an
- <code>INVALID_CHARACTER_ERR</code> exception and stop the algorithm.
+ <dt>If the element is a <code><a href="#blockquote">blockquote</a></code>,
+ <code><a href="#q">q</a></code>, <code><a href="#ins">ins</a></code>, or
+ <code><a href="#del">del</a></code> element with a <code
+ title="">cite</code> attribute
- <li>Otherwise, <a href="#split" title="split a string on spaces">split the
- underlying string on spaces</a> to get the list of tokens in the object's
- underlying string.
+ <dd>
+ <p>If the <a href="#absolute">absolute URL</a> identified by the <code
+ title="">cite</code> attribute is being shown to the user, or if any
+ data derived from that URL is affecting the display, then the it should
+ be <a href="#resolve" title="resolve a url">reresolved</a> and the UI
+ updated appropriately.</p>
- <li>If the given <var title="">token</var> is already one of the tokens in
- the <code><a href="#domtokenlist0">DOMTokenList</a></code> object's
- underlying string then <a href="#remove" title="remove a token from a
- string">remove the given <var title="">token</var> from the underlying
- string</a>, and stop the algorithm, returning false.
+ <dt>Otherwise
- <li>Otherwise, if the <code><a
- href="#domtokenlist0">DOMTokenList</a></code> object's underlying string
- is not the empty string and the last character of that string is not a <a
- href="#space">space character</a>, then append a U+0020 SPACE character
- to the end of that string.
+ <dd>
+ <p>The element is not directly affected.</p>
- <li>Append the value of <var title="">token</var> to the end of the
- <code><a href="#domtokenlist0">DOMTokenList</a></code> object's
- underlying string.
+ <p class=example>Changing the base URL doesn't affect the image displayed
+ by <code><a href="#img">img</a></code> elements, although subsequent
+ accesses of the <code title=dom-img-src><a href="#src0">src</a></code>
+ DOM attribute from script will return a new <a href="#absolute">absolute
+ URL</a> that might no longer correspond to the image being shown.</p>
+ </dl>
- <li>Return true.
- </ol>
+ <h4 id=interfaces><span class=secno>2.5.5 </span>Interfaces for URL
+ manipulation</h4>
- <p>Objects implementing the <code><a
- href="#domtokenlist0">DOMTokenList</a></code> interface must <dfn
- id=stringify title=dom-tokenlist-toString>stringify</dfn> to the object's
- underlying string representation.
+ <p>An interface that has a complement of <dfn id=url-decomposition>URL
+ decomposition attributes</dfn> will have seven attributes with the
+ following definitions:
- <h4 id=domstringmap><span class=secno>2.6.4 </span>DOMStringMap</h4>
+ <pre class=idl>
+ attribute DOMString <a href="#protocol" title=dom-uda-protocol>protocol</a>;
+ attribute DOMString <a href="#host" title=dom-uda-host>host</a>;
+ attribute DOMString <a href="#hostname" title=dom-uda-hostname>hostname</a>;
+ attribute DOMString <a href="#port" title=dom-uda-port>port</a>;
+ attribute DOMString <a href="#pathname" title=dom-uda-pathname>pathname</a>;
+ attribute DOMString <a href="#search" title=dom-uda-search>search</a>;
+ attribute DOMString <a href="#hash" title=dom-uda-hash>hash</a>;
+</pre>
- <p>The <code><a href="#domstringmap0">DOMStringMap</a></code> interface
- represents a set of name-value pairs. When a <code><a
- href="#domstringmap0">DOMStringMap</a></code> object is instanced, it is
- associated with three algorithms, one for getting values from names, one
- for setting names to certain values, and one for deleting names.
+ <p>The attributes defined to be URL decomposition attributes must act as
+ described for the attributes with the same corresponding names in this
+ section.
- <p class=big-issue>The names of the methods on this interface are temporary
- and will be fixed when the Web IDL / "Language Bindings for DOM
- Specifications" spec is ready to handle this case.
+ <p>In addition, an interface with a complement of URL decomposition
+ attributes will define an <dfn id=input
+ title=concept-uda-input>input</dfn>, which is a <a href="#url">URL</a>
+ that the attributes act on, and a <dfn id=common3
+ title=concept-uda-setter>common setter action</dfn>, which is a set of
+ steps invoked when any of the attributes' setters are invoked.
- <pre class=idl>interface <dfn id=domstringmap0>DOMStringMap</dfn> {
- [NameGetter] DOMString <a href="#xxx1name" title=dom-stringmap-XXX1>XXX1</a>(in DOMString name); <!-- XXX DOMB -->
- [NameSetter] void <a href="#xxx2name" title=dom-stringmap-XXX2>XXX2</a>(in DOMString name, in DOMString value); <!-- XXX DOMB -->
- [XXX] boolean <a href="#xxx3name" title=dom-stringmap-XXX3>XXX3</a>(in DOMString name); <!-- XXX DOMB -->
-};</pre>
+ <p>The seven URL decomposition attributes have similar requirements.
- <p>The <dfn id=xxx1name title=dom-stringmap-XXX1><code>XXX1(<var
- title="">name</var>)</code></dfn> method must call the algorithm for
- getting values from names, passing <var title="">name</var> as the name,
- and must return the corresponding value, or null if <var
- title="">name</var> has no corresponding value.
+ <p>On getting, if the <a href="#input" title=concept-uda-input>input</a>
+ fulfills the condition given in the "getter condition" column
+ corresponding to the attribute in the table below, the user agent must
+ return the part of the <a href="#input" title=concept-uda-input>input</a>
+ URL given in the "component" column, with any prefixes specified in the
+ "prefix" column appropriately added to the start of the string and any
+ suffixes specified in the "suffix" column appropriately added to the end
+ of the string. Otherwise, the attribute must return the empty string.
- <p>The <dfn id=xxx2name title=dom-stringmap-XXX2><code>XXX2(<var
- title="">name</var>, <var title="">value</var>)</code></dfn> method must
- call the algorithm for setting names to certain values, passing <var
- title="">name</var> as the name and <var title="">value</var> as the
- value.
+ <p>On setting, the new value must first be mutated as described by the
+ "setter preprocessor" column, then mutated by %-escaping any characters in
+ the new value that are not valid in the relevant component as given by the
+ "component" column. Then, if the resulting new value fulfills the
+ condition given in the "setter condition" column, the user agent must make
+ a new string <var title="">output</var> by replacing the component of the
+ URL given by the "component" column in the <a href="#input"
+ title=concept-uda-input>input</a> URL with the new value; otherwise, the
+ user agent must let <var title="">output</var> be equal to the <a
+ href="#input" title=concept-uda-input>input</a>. Finally, the user agent
+ must invoke the <a href="#common3" title=concept-uda-setter>common setter
+ action</a> with the value of <var title="">output</var>.
- <p>The <dfn id=xxx3name title=dom-stringmap-XXX3><code>XXX3(<var
- title="">name</var>)</code></dfn> method must call the algorithm for
- deleting names, passing <var title="">name</var> as the name, and must
- return true.
+ <p>When replacing a component in the URL, if the component is part of an
+ optional group in the URL syntax consisting of a character followed by the
+ component, the component (including its prefix character) must be included
+ even if the new value is the empty string.
- <h4 id=dom-feature><span class=secno>2.6.5 </span>DOM feature strings</h4>
+ <p class=note>The previous paragraph applies in particular to the "<code
+ title="">:</code>" before a <port> component, the "<code
+ title="">?</code>" before a <query> component, and the "<code
+ title="">#</code>" before a <fragment> component.
- <p>DOM3 Core defines mechanisms for checking for interface support, and for
- obtaining implementations of interfaces, using <a
- href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMFeatures">feature
- strings</a>. <a href="#refsDOM3CORE">[DOM3CORE]</a>
+ <p>For the purposes of the above definitions, URLs must be parsed using the
+ <a href="#parse0" title="parse a URL">URL parsing rules</a> defined in
+ this specification.
- <p>A DOM application can use the <dfn id=hasfeature
- title=hasFeature><code>hasFeature(<var title="">feature</var>, <var
- title="">version</var>)</code></dfn> method of the
- <code>DOMImplementation</code> interface with parameter values "<code
- title="">HTML</code>" and "<code>5.0</code>" (respectively) to determine
- whether or not this module is supported by the implementation. In addition
- to the feature string "<code title="">HTML</code>", the feature string
- "<code title="">XHTML</code>" (with version string "<code>5.0</code>") can
- be used to check if the implementation supports XHTML. User agents should
- respond with a true value when the <code><a
- href="#hasfeature">hasFeature</a></code> method is queried with these
- values. Authors are cautioned, however, that UAs returning true might not
- be perfectly compliant, and that UAs returning false might well have
- support for features in this specification; in general, therefore, use of
- this method is discouraged.
+ <table>
+ <thead>
+ <tr>
+ <th>Attribute
- <p>The values "<code title="">HTML</code>" and "<code
- title="">XHTML</code>" (both with version "<code>5.0</code>") should also
- be supported in the context of the <code>getFeature()</code> and
- <code>isSupported()</code> methods, as defined by DOM3 Core.
+ <th>Component
- <p class=note>The interfaces defined in this specification are not always
- supersets of the interfaces defined in DOM2 HTML; some features that were
- formerly deprecated, poorly supported, rarely used or considered
- unnecessary have been removed. Therefore it is not guaranteed that an
- implementation that supports "<code title="">HTML</code>"
- "<code>5.0</code>" also supports "<code title="">HTML</code>"
- "<code>2.0</code>".
+ <th>Getter Condition
- <h3 id=fetching><span class=secno>2.7 </span>Fetching resources</h3>
+ <th>Prefix
+ <th>Suffix
+
+ <th>Setter Preprocessor
+
+ <th>Setter Condition
+
+ <tbody>
+ <tr>
+ <td><dfn id=protocol title=dom-uda-protocol><code>protocol</code></dfn>
+
+ <td><a href="#ltschemegt" title=url-scheme><scheme></a>
+
+ <td>—
+
+ <td>—
+
+ <td>U+003A COLON ("<code title="">:</code>")
+
+ <td>Remove all trailing U+003A COLON ("<code title="">:</code>")
+ characters
+
+ <td>The new value is not the empty string
+
+ <tr>
+ <td><dfn id=host title=dom-uda-host><code>host</code></dfn>
+
+ <td><a href="#lthostportgt" title=url-hostport><hostport></a>
+
+ <td><a href="#input" title=concept-uda-input>input</a> is hierarchical
+ and uses a server-based naming authority
+
+ <td>—
+
+ <td>—
+
+ <td>—
+
+ <td>—
+
+ <tr>
+ <td><dfn id=hostname title=dom-uda-hostname><code>hostname</code></dfn>
+
+ <td><a href="#lthostgt" title=url-host><host></a>
+
+ <td><a href="#input" title=concept-uda-input>input</a> is hierarchical
+ and uses a server-based naming authority
+
+ <td>—
+
+ <td>—
+
+ <td>Remove all leading U+002F SOLIDUS ("<code title="">/</code>")
+ characters
+
+ <td>—
+
+ <tr>
+ <td><dfn id=port title=dom-uda-port><code>port</code></dfn>
+
+ <td><a href="#ltportgt" title=url-port><port></a>
+
+ <td><a href="#input" title=concept-uda-input>input</a> is hierarchical,
+ uses a server-based naming authority, and contained a <a
+ href="#ltportgt" title=url-port><port></a> component (possibly an
+ empty one)
+
+ <td>—
+
+ <td>—
+
+ <td>Remove any characters in the new value that are not in the range
+ U+0030 DIGIT ZERO .. U+0039 DIGIT NINE. If the resulting string is
+ empty, set it to a single U+0030 DIGIT ZERO character ('0').
+
+ <td>—
+
+ <tr>
+ <td><dfn id=pathname title=dom-uda-pathname><code>pathname</code></dfn>
+
+ <td><a href="#ltpathgt" title=url-path><path></a>
+
+ <td><a href="#input" title=concept-uda-input>input</a> is hierarchical
+
+ <td>—
+
+ <td>—
+
+ <td>If it has no leading U+002F SOLIDUS ("<code title="">/</code>")
+ character, prepend a U+002F SOLIDUS ("<code title="">/</code>")
+ character to the new value
+
+ <td>—
+
+ <tr>
+ <td><dfn id=search title=dom-uda-search><code>search</code></dfn>
+
+ <td><a href="#ltquerygt" title=url-query><query></a>
+
+ <td><a href="#input" title=concept-uda-input>input</a> is hierarchical,
+ and contained a <a href="#ltquerygt" title=url-query><query></a>
+ component (possibly an empty one)
+
+ <td>U+003F QUESTION MARK ("<code title="">?</code>")
+
+ <td>—
+
+ <td>Remove one leading U+003F QUESTION MARK ("<code title="">?</code>")
+ character, if any
+
+ <td>—
+
+ <tr>
+ <td><dfn id=hash title=dom-uda-hash><code>hash</code></dfn>
+
+ <td><a href="#ltfragmentgt" title=url-fragment><fragment></a>
+
+ <td><a href="#input" title=concept-uda-input>input</a> contained a <a
+ href="#ltfragmentgt" title=url-fragment><fragment></a> component
+ (possibly an empty one)
+
+ <td>U+0023 NUMBER SIGN ("<code title="">#</code>")
+
+ <td>—
+
+ <td>Remove one leading U+0023 NUMBER SIGN ("<code title="">#</code>")
+ character, if any
+
+ <td>—
+ </table>
+ <!--
+ http://www.hixie.ch/tests/adhoc/dom/level0/location/components/
+ http://lxr.mozilla.org/seamonkey/source/dom/src/base/nsLocation.cpp
+ http://wp.netscape.com/eng/mozilla/3.0/handbook/javascript/ref_h-l.htm#84722
+-->
+
+ <div class=example>
+ <p>The table below demonstrates how the getter condition for <code
+ title=dom-uda-search><a href="#search">search</a></code> results in
+ different results depending on the exact original syntax of the URL:</p>
+
+ <table>
+ <thead>
+ <tr>
+ <th> Input URL
+
+ <th> <code title=dom-uda-search><a href="#search">search</a></code>
+ value
+
+ <th> Explanation
+
+ <tbody>
+ <tr>
+ <td> <code title="">http://example.com/</code>
+
+ <td> <i>empty string</i>
+
+ <td> No <a href="#ltquerygt" title=url-query><query></a>
+ component in input URL.
+
+ <tr>
+ <td> <code title="">http://example.com/?</code>
+
+ <td> <code title="">?</code>
+
+ <td> There is a <a href="#ltquerygt" title=url-query><query></a>
+ component, but it is empty. The question mark in the resulting value
+ is the prefix.
+
+ <tr>
+ <td> <code title="">http://example.com/?test</code>
+
+ <td> <code title="">?test</code>
+
+ <td> The <a href="#ltquerygt" title=url-query><query></a>
+ component has the value "<code title="">test</code>".
+
+ <tr>
+ <td> <code title="">http://example.com/?test#</code>
+
+ <td> <code title="">?test</code>
+
+ <td> The (empty) <a href="#ltfragmentgt"
+ title=url-fragment><fragment></a> component is not part of the
+ <a href="#ltquerygt" title=url-query><query></a> component.
+ </table>
+ </div>
+
+ <h3 id=fetching><span class=secno>2.6 </span>Fetching resources</h3>
+
<p class=big-issue>replace all instances of the word 'fetch' or 'download'
with a reference to this section, and put something here that talks about
caching, that redirects to the offline storage stuff when appropriate,
@@ -5935,7 +5337,7 @@
(e.g. not loading video poster frames until the video is on the
screen) -->
- <h3 id=content-type-sniffing><span class=secno>2.8 </span>Determining the
+ <h3 id=content-type-sniffing><span class=secno>2.7 </span>Determining the
type of a resource</h3>
<p class=warning>It is imperative that the rules in this section be
@@ -5947,7 +5349,7 @@
the end user can be exposed to malicious content, making the user
vulnerable to cookie theft attacks and other cross-site scripting attacks.
- <h4 id=content-type><span class=secno>2.8.1 </span>Content-Type metadata</h4>
+ <h4 id=content-type><span class=secno>2.7.1 </span>Content-Type metadata</h4>
<p>What explicit <dfn id=content-type5 title=Content-Type>Content-Type
metadata</dfn> is associated with the resource (the resource's type
@@ -6030,7 +5432,7 @@
<p class=note>The above algorithm is a willful violation of the HTTP
specification. <a href="#refsRFC2616">[RFC2616]</a>
- <h4 id=content-type0><span class=secno>2.8.2 </span>Content-Type sniffing:
+ <h4 id=content-type0><span class=secno>2.7.2 </span>Content-Type sniffing:
Web pages</h4>
<p>The <dfn id=sniffed title="Content-Type sniffing">sniffed type of a
@@ -6135,7 +5537,7 @@
<p>The sniffed type of the resource is <var title="">official type</var>.
</ol>
- <h4 id=content-type1><span class=secno>2.8.3 </span><dfn
+ <h4 id=content-type1><span class=secno>2.7.3 </span><dfn
id=content-type6>Content-Type sniffing: text or binary</dfn></h4>
<ol>
@@ -6239,7 +5641,7 @@
<li> 0x1C - 0x1F
</ul>
- <h4 id=content-type2><span class=secno>2.8.4 </span><dfn
+ <h4 id=content-type2><span class=secno>2.7.4 </span><dfn
id=content-type7>Content-Type sniffing: unknown type</dfn></h4>
<ol>
@@ -6575,7 +5977,7 @@
binary" section, to avoid sniffing <code title="">text/plain</code>
content as a type that can be used for a privilege escalation attack.
- <h4 id=content-type3><span class=secno>2.8.5 </span><dfn
+ <h4 id=content-type3><span class=secno>2.7.5 </span><dfn
id=content-type8>Content-Type sniffing: image</dfn></h4>
<p>If the first bytes of the resource match one of the byte sequences in
@@ -6644,7 +6046,7 @@
<p>Otherwise, the sniffed type of the resource is the same as its <var
title="">official type</var>.
- <h4 id=content-type4><span class=secno>2.8.6 </span><dfn
+ <h4 id=content-type4><span class=secno>2.7.6 </span><dfn
id=content-type9>Content-Type sniffing: feed or HTML</dfn></h4>
<!-- mostly based on:
http://blogs.msdn.com/rssteam/articles/PublishersGuide.aspx
@@ -6823,6 +6225,604 @@
this algorithm and the algorithm for detecting the character encoding of
HTML documents in parallel.
+ <h3 id=common2><span class=secno>2.8 </span>Common DOM interfaces</h3>
+
+ <h4 id=reflecting><span class=secno>2.8.1 </span>Reflecting content
+ attributes in DOM attributes</h4>
+
+ <p>Some <span title="DOM attribute">DOM attributes</span> are defined to
+ <dfn id=reflect>reflect</dfn> a particular <span>content attribute</span>.
+ This means that on getting, the DOM attribute returns the current value of
+ the content attribute, and on setting, the DOM attribute changes the value
+ of the content attribute to the given value.
+
+ <p>If a reflecting DOM attribute is a <code>DOMString</code> attribute
+ whose content attribute is defined to contain a <a href="#url">URL</a>,
+ then on getting, the DOM attribute must <a href="#resolve" title="resolve
+ a url">resolve</a> the value of the content attribute and return the
+ resulting <a href="#absolute">absolute URL</a> if that was successful, or
+ the empty string otherwise; and on setting, must set the content attribute
+ to the specified literal value. If the content attribute is absent, the
+ DOM attribute must return the default value, if the content attribute has
+ one, or else the empty string.
+
+ <p>If a reflecting DOM attribute is a <code>DOMString</code> attribute
+ whose content attribute is defined to contain one or more <a href="#url"
+ title=URL>URLs</a>, then on getting, the DOM attribute must <span
+ title="split the string on spaces">split the content attribute on
+ spaces</span> and return the concatenation of <a href="#resolve"
+ title="resolve a URL">resolving</a> each token URL to an <a
+ href="#absolute">absolute URL</a>, with a single U+0020 SPACE character
+ between each URL, ignoring any tokens that did not resolve successfully.
+ If the content attribute is absent, the DOM attribute must return the
+ default value, if the content attribute has one, or else the empty string.
+ On setting, the DOM attribute must set the content attribute to the
+ specified literal value.
+
+ <p>If a reflecting DOM attribute is a <code>DOMString</code> whose content
+ attribute is an <a href="#enumerated">enumerated attribute</a>, and the
+ DOM attribute is <dfn id=limited>limited to only known values</dfn>, then,
+ on getting, the DOM attribute must return the conforming value associated
+ with the state the attribute is in (in its canonical case), or the empty
+ string if the attribute is in a state that has no associated keyword
+ value; and on setting, if the new value is an <a href="#ascii">ASCII
+ case-insensitive</a> match for one of the keywords given for that
+ attribute, then the content attribute must be set to the conforming value
+ associated with the state that the attribute would be in if set to the
+ given new value, otherwise, if the new value is the empty string, then the
+ content attribute must be removed, otherwise, the setter must raise a
+ <code>SYNTAX_ERR</code> exception.
+
+ <p>If a reflecting DOM attribute is a <code>DOMString</code> but doesn't
+ fall into any of the above categories, then the getting and setting must
+ be done in a transparent, case-preserving manner.
+
+ <p>If a reflecting DOM attribute is a boolean attribute, then on getting
+ the DOM attribute must return true if the attribute is set, and false if
+ it is absent. On setting, the content attribute must be removed if the DOM
+ attribute is set to false, and must be set to have the same value as its
+ name if the DOM attribute is set to true. (This corresponds to the rules
+ for <a href="#boolean0" title="boolean attribute">boolean content
+ attributes</a>.)
+
+ <p>If a reflecting DOM attribute is a signed integer type
+ (<code>long</code>) then, on getting, the content attribute must be parsed
+ according to <a href="#rules0" title="rules for parsing integers">the
+ rules for parsing signed integers</a>, and if that is successful, the
+ resulting value must be returned. If, on the other hand, it fails, or if
+ the attribute is absent, then the default value must be returned instead,
+ or 0 if there is no default value. On setting, the given value must be
+ converted to the shortest possible string representing the number as a <a
+ href="#valid0">valid integer</a> in base ten and then that string must be
+ used as the new content attribute value.
+
+ <p>If a reflecting DOM attribute is an <em>unsigned</em> integer type
+ (<code>unsigned long</code>) then, on getting, the content attribute must
+ be parsed according to <a href="#rules" title="rules for parsing
+ non-negative integers">the rules for parsing unsigned integers</a>, and if
+ that is successful, the resulting value must be returned. If, on the other
+ hand, it fails, or if the attribute is absent, the default value must be
+ returned instead, or 0 if there is no default value. On setting, the given
+ value must be converted to the shortest possible string representing the
+ number as a <a href="#valid">valid non-negative integer</a> in base ten
+ and then that string must be used as the new content attribute value.
+
+ <p>If a reflecting DOM attribute is an unsigned integer type
+ (<code>unsigned long</code>) that is <dfn id=limited0>limited to only
+ positive non-zero numbers</dfn>, then the behavior is similar to the
+ previous case, but zero is not allowed. On getting, the content attribute
+ must first be parsed according to <a href="#rules" title="rules for
+ parsing non-negative integers">the rules for parsing unsigned
+ integers</a>, and if that is successful, the resulting value must be
+ returned. If, on the other hand, it fails, or if the attribute is absent,
+ the default value must be returned instead, or 1 if there is no default
+ value. On setting, if the value is zero, the user agent must fire an
+ <code>INDEX_SIZE_ERR</code> exception. Otherwise, the given value must be
+ converted to the shortest possible string representing the number as a <a
+ href="#valid">valid non-negative integer</a> in base ten and then that
+ string must be used as the new content attribute value.
+
+ <p>If a reflecting DOM attribute is a floating point number type
+ (<code>float</code>) and the content attribute is defined to contain a
+ time offset, then, on getting, the content attribute must be parsed
+ according to <a href="#rules4" title="rules for parsing time offsets">the
+ rules for parsing time offsets</a>, and if that is successful, the
+ resulting value, in seconds, must be returned. If that fails, or if the
+ attribute is absent, the default value must be returned, or the
+ not-a-number value (NaN) if there is no default value. On setting, the
+ given value, interpreted as a time offset in seconds, must be converted to
+ a string using the <a href="#time-offset">time offset serialization
+ rules</a>, and that string must be used as the new content attribute
+ value.
+
+ <p>If a reflecting DOM attribute is a floating point number type
+ (<code>float</code>) and it doesn't fall into one of the earlier
+ categories, then, on getting, the content attribute must be parsed
+ according to <a href="#rules1" title="rules for parsing floating point
+ number values">the rules for parsing floating point number values</a>, and
+ if that is successful, the resulting value must be returned. If, on the
+ other hand, it fails, or if the attribute is absent, the default value
+ must be returned instead, or 0.0 if there is no default value. On setting,
+ the given value must be converted to the shortest possible string
+ representing the number as a <a href="#valid1">valid floating point
+ number</a> in base ten and then that string must be used as the new
+ content attribute value.
+
+ <p>If a reflecting DOM attribute is of the type <code><a
+ href="#domtokenlist0">DOMTokenList</a></code>, then on getting it must
+ return a <code><a href="#domtokenlist0">DOMTokenList</a></code> object
+ whose underlying string is the element's corresponding content attribute.
+ When the <code><a href="#domtokenlist0">DOMTokenList</a></code> object
+ mutates its underlying string, the content attribute must itself be
+ immediately mutated. When the attribute is absent, then the string
+ represented by the <code><a href="#domtokenlist0">DOMTokenList</a></code>
+ object is the empty string; when the object mutates this empty string, the
+ user agent must first add the corresponding content attribute, and then
+ mutate that attribute instead. <code><a
+ href="#domtokenlist0">DOMTokenList</a></code> attributes are always
+ read-only. The same <code><a href="#domtokenlist0">DOMTokenList</a></code>
+ object must be returned every time for each attribute.
+
+ <p>If a reflecting DOM attribute has the type <code><a
+ href="#htmlelement">HTMLElement</a></code>, or an interface that descends
+ from <code><a href="#htmlelement">HTMLElement</a></code>, then, on
+ getting, it must run the following algorithm (stopping at the first point
+ where a value is returned):
+
+ <ol>
+ <li>If the corresponding content attribute is absent, then the DOM
+ attribute must return null.
+
+ <li>Let <var title="">candidate</var> be the element that the <code
+ title="">document.getElementById()</code> method would find if it was
+ passed as its argument the current value of the corresponding content
+ attribute.
+
+ <li>If <var title="">candidate</var> is null, or if it is not
+ type-compatible with the DOM attribute, then the DOM attribute must
+ return null.
+
+ <li>Otherwise, it must return <var title="">candidate</var>.
+ </ol>
+
+ <p>On setting, if the given element has an <code title=attr-id><a
+ href="#id">id</a></code> attribute, then the content attribute must be set
+ to the value of that <code title=attr-id><a href="#id">id</a></code>
+ attribute. Otherwise, the DOM attribute must be set to the empty string.</p>
+ <!-- XXX or raise an exception? -->
+
+ <h4 id=collections><span class=secno>2.8.2 </span>Collections</h4>
+
+ <p>The <code><a href="#htmlcollection0">HTMLCollection</a></code>, <code><a
+ href="#htmlformcontrolscollection0">HTMLFormControlsCollection</a></code>,
+ and <code><a
+ href="#htmloptionscollection0">HTMLOptionsCollection</a></code> interfaces
+ represent various lists of DOM nodes. Collectively, objects implementing
+ these interfaces are called <dfn id=collections0>collections</dfn>.
+
+ <p>When a <a href="#collections0" title=collections>collection</a> is
+ created, a filter and a root are associated with the collection.
+
+ <p class=example>For example, when the <code><a
+ href="#htmlcollection0">HTMLCollection</a></code> object for the <code
+ title=dom-document-images><a href="#images0">document.images</a></code>
+ attribute is created, it is associated with a filter that selects only
+ <code><a href="#img">img</a></code> elements, and rooted at the root of
+ the document.
+
+ <p>The <a href="#collections0" title=collections>collection</a> then <dfn
+ id=represents title="represented by the collection">represents</dfn> a <a
+ href="#live">live</a> view of the subtree rooted at the collection's root,
+ containing only nodes that match the given filter. The view is linear. In
+ the absence of specific requirements to the contrary, the nodes within the
+ collection must be sorted in <a href="#tree-order">tree order</a>.
+
+ <p class=note>The <code title=dom-table-rows><a
+ href="#rows">rows</a></code> list is not in tree order.
+
+ <p>An attribute that returns a collection must return the same object every
+ time it is retrieved.
+
+ <h5 id=htmlcollection><span class=secno>2.8.2.1. </span>HTMLCollection</h5>
+
+ <p>The <code><a href="#htmlcollection0">HTMLCollection</a></code> interface
+ represents a generic <a href="#collections0"
+ title=collections>collection</a> of elements.
+
+ <pre class=idl>interface <dfn id=htmlcollection0>HTMLCollection</dfn> {
+ readonly attribute unsigned long <a href="#length" title=dom-HTMLCollection-length>length</a>;
+ [IndexGetter] Element <a href="#itemindex" title=dom-HTMLCollection-item>item</a>(in unsigned long index);
+ [NameGetter] Element <a href="#nameditem" title=dom-HTMLCollection-namedItem>namedItem</a>(in DOMString name);
+};</pre>
+
+ <p>The <dfn id=length
+ title=dom-HTMLCollection-length><code>length</code></dfn> attribute must
+ return the number of nodes <a href="#represents">represented by the
+ collection</a>.
+
+ <p>The <dfn id=itemindex title=dom-HTMLCollection-item><code>item(<var
+ title="">index</var>)</code></dfn> method must return the <var
+ title="">index</var>th node in the collection. If there is no <var
+ title="">index</var>th node in the collection, then the method must return
+ null.
+
+ <p>The <dfn id=nameditem
+ title=dom-HTMLCollection-namedItem><code>namedItem(<var
+ title="">key</var>)</code></dfn> method must return the first node in the
+ collection that matches the following requirements:
+
+ <ul>
+ <li>It is an <code><a href="#a">a</a></code>, <code><a
+ href="#applet">applet</a></code>, <code><a href="#area">area</a></code>,
+ <code>form</code>, <code><a href="#img">img</a></code>, or <code><a
+ href="#object">object</a></code> element with a <code
+ title=attr-name>name</code> attribute equal to <var title="">key</var>,
+ or,
+
+ <li>It is an <a href="#html-elements" title="HTML elements">HTML
+ element</a> of any kind with an <code title=attr-id><a
+ href="#id">id</a></code> attribute equal to <var title="">key</var>.
+ (Non-HTML elements, even if they have IDs, are not searched for the
+ purposes of <code title=dom-HTMLCollection-namedItem><a
+ href="#nameditem">namedItem()</a></code>.)
+ </ul>
+
+ <p>If no such elements are found, then the method must return null.
+
+ <h5 id=htmlformcontrolscollection><span class=secno>2.8.2.2.
+ </span>HTMLFormControlsCollection</h5>
+
+ <p>The <code><a
+ href="#htmlformcontrolscollection0">HTMLFormControlsCollection</a></code>
+ interface represents a <a href="#collections0"
+ title=collections>collection</a> of form controls.
+
+ <pre
+ class=idl>interface <dfn id=htmlformcontrolscollection0>HTMLFormControlsCollection</dfn> {
+ readonly attribute unsigned long <a href="#length0" title=dom-HTMLFormControlsCollection-length>length</a>;
+ [IndexGetter] <a href="#htmlelement">HTMLElement</a> <a href="#itemindex0" title=dom-HTMLFormControlsCollection-item>item</a>(in unsigned long index);
+ [NameGetter] Object <a href="#nameditem0" title=dom-HTMLFormControlsCollection-namedItem>namedItem</a>(in DOMString name);
+};</pre>
+
+ <p>The <dfn id=length0
+ title=dom-HTMLFormControlsCollection-length><code>length</code></dfn>
+ attribute must return the number of nodes <a
+ href="#represents">represented by the collection</a>.
+
+ <p>The <dfn id=itemindex0
+ title=dom-HTMLFormControlsCollection-item><code>item(<var
+ title="">index</var>)</code></dfn> method must return the <var
+ title="">index</var>th node in the collection. If there is no <var
+ title="">index</var>th node in the collection, then the method must return
+ null.
+
+ <p>The <dfn id=nameditem0
+ title=dom-HTMLFormControlsCollection-namedItem><code>namedItem(<var
+ title="">key</var>)</code></dfn> method must act according to the
+ following algorithm:
+
+ <ol>
+ <li>If, at the time the method is called, there is exactly one node in the
+ collection that has either an <code title=attr-id><a
+ href="#id">id</a></code> attribute or a <code title=attr-name>name</code>
+ attribute equal to <var title="">key</var>, then return that node and
+ stop the algorithm.
+
+ <li>Otherwise, if there are no nodes in the collection that have either an
+ <code title=attr-id><a href="#id">id</a></code> attribute or a <code
+ title=attr-name>name</code> attribute equal to <var title="">key</var>,
+ then return null and stop the algorithm.
+
+ <li>Otherwise, create a <code>NodeList</code> object representing a live
+ view of the <code><a
+ href="#htmlformcontrolscollection0">HTMLFormControlsCollection</a></code>
+ object, further filtered so that the only nodes in the
+ <code>NodeList</code> object are those that have either an <code
+ title=attr-id><a href="#id">id</a></code> attribute or a <code
+ title=attr-name>name</code> attribute equal to <var title="">key</var>.
+ The nodes in the <code>NodeList</code> object must be sorted in <a
+ href="#tree-order">tree order</a>.
+
+ <li>Return that <code>NodeList</code> object.
+ </ol>
+ <!--
+http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E...%0A%3Cform%20name%3D%22a%22%3E%3Cinput%20id%3D%22x%22%20name%3D%22y%22%3E%3Cinput%20name%3D%22x%22%20id%3D%22y%22%3E%3C/form%3E%0A%3Cscript%3E%0A%20%20var%20x%3B%0A%20%20w%28x%20%3D%20document.forms%5B%27a%27%5D%5B%27x%27%5D%29%3B%0A%20%20w%28x.length%29%3B%0A%20%20x%5B0%5D.parentNode.removeChild%28x%5B0%5D%29%3B%0A%20%20w%28x.length%29%3B%0A%20%20w%28x%20%3D%3D%20document.forms%5B%27a%27%5D%5B%27x%27%5D%29%3B%0A%3C/script%3E%0A
+-->
+
+ <h5 id=htmloptionscollection><span class=secno>2.8.2.3.
+ </span>HTMLOptionsCollection</h5>
+
+ <p>The <code><a
+ href="#htmloptionscollection0">HTMLOptionsCollection</a></code> interface
+ represents a list of <code>option</code> elements.
+
+ <pre
+ class=idl>interface <dfn id=htmloptionscollection0>HTMLOptionsCollection</dfn> {
+ attribute unsigned long <a href="#length1" title=dom-HTMLOptionsCollection-length>length</a>;
+ [IndexGetter] HTMLOptionElement <a href="#itemindex1" title=dom-HTMLOptionsCollection-item>item</a>(in unsigned long index);
+ [NameGetter] Object <a href="#nameditem1" title=dom-HTMLOptionsCollection-namedItem>namedItem</a>(in DOMString name);
+};</pre>
+
+ <p>On getting, the <dfn id=length1
+ title=dom-HTMLOptionsCollection-length><code>length</code></dfn> attribute
+ must return the number of nodes <a href="#represents">represented by the
+ collection</a>.
+
+ <p>On setting, the behavior depends on whether the new value is equal to,
+ greater than, or less than the number of nodes <a
+ href="#represents">represented by the collection</a> at that time. If the
+ number is the same, then setting the attribute must do nothing. If the new
+ value is greater, then <var title="">n</var> new <code>option</code>
+ elements with no attributes and no child nodes must be appended to the
+ <code>select</code> element on which the <code><a
+ href="#htmloptionscollection0">HTMLOptionsCollection</a></code> is rooted,
+ where <var title="">n</var> is the difference between the two numbers (new
+ value minus old value). If the new value is lower, then the last <var
+ title="">n</var> nodes in the collection must be removed from their parent
+ nodes, where <var title="">n</var> is the difference between the two
+ numbers (old value minus new value).
+
+ <p class=note>Setting <code title=dom-HTMLOptionsCollection-length><a
+ href="#length1">length</a></code> never removes or adds any
+ <code>optgroup</code> elements, and never adds new children to existing
+ <code>optgroup</code> elements (though it can remove children from them).
+
+ <p>The <dfn id=itemindex1
+ title=dom-HTMLOptionsCollection-item><code>item(<var
+ title="">index</var>)</code></dfn> method must return the <var
+ title="">index</var>th node in the collection. If there is no <var
+ title="">index</var>th node in the collection, then the method must return
+ null.
+
+ <p>The <dfn id=nameditem1
+ title=dom-HTMLOptionsCollection-namedItem><code>namedItem(<var
+ title="">key</var>)</code></dfn> method must act according to the
+ following algorithm:
+
+ <ol>
+ <li>If, at the time the method is called, there is exactly one node in the
+ collection that has either an <code title=attr-id><a
+ href="#id">id</a></code> attribute or a <code title=attr-name>name</code>
+ attribute equal to <var title="">key</var>, then return that node and
+ stop the algorithm.
+
+ <li>Otherwise, if there are no nodes in the collection that have either an
+ <code title=attr-id><a href="#id">id</a></code> attribute or a <code
+ title=attr-name>name</code> attribute equal to <var title="">key</var>,
+ then return null and stop the algorithm.
+
+ <li>Otherwise, create a <code>NodeList</code> object representing a live
+ view of the <code><a
+ href="#htmloptionscollection0">HTMLOptionsCollection</a></code> object,
+ further filtered so that the only nodes in the <code>NodeList</code>
+ object are those that have either an <code title=attr-id><a
+ href="#id">id</a></code> attribute or a <code
+ title=attr-option-name>name</code> attribute equal to <var
+ title="">key</var>. The nodes in the <code>NodeList</code> object must be
+ sorted in <a href="#tree-order">tree order</a>.
+
+ <li>Return that <code>NodeList</code> object.
+ </ol>
+ <!-- see also http://ln.hixie.ch/?start=1161042744&count=1 -->
+
+ <p class=big-issue>We may want to add <code>add()</code> and
+ <code>remove()</code> methods here too because IE implements
+ HTMLSelectElement and HTMLOptionsCollection on the same object, and so
+ people use them almost interchangeably in the wild.
+
+ <h4 id=domtokenlist><span class=secno>2.8.3 </span>DOMTokenList</h4>
+
+ <p>The <code><a href="#domtokenlist0">DOMTokenList</a></code> interface
+ represents an interface to an underlying string that consists of an <a
+ href="#unordered">unordered set of unique space-separated tokens</a>.
+
+ <p>Which string underlies a particular <code><a
+ href="#domtokenlist0">DOMTokenList</a></code> object is defined when the
+ object is created. It might be a content attribute (e.g. the string that
+ underlies the <code title=dom-classList><a
+ href="#classlist">classList</a></code> object is the <code
+ title=attr-class><a href="#class">class</a></code> attribute), or it might
+ be an anonymous string (e.g. when a <code><a
+ href="#domtokenlist0">DOMTokenList</a></code> object is passed to an
+ author-implemented callback in the <code><a
+ href="#datagrid0">datagrid</a></code> APIs).
+
+ <pre
+ class=idl>[<a href="#stringify" title=dom-tokenlist-toString>Stringifies</a>] interface <dfn id=domtokenlist0>DOMTokenList</dfn> {
+ readonly attribute unsigned long <a href="#length2" title=dom-tokenlist-length>length</a>;
+ [IndexGetter] DOMString <a href="#itemindex2" title=dom-tokenlist-item>item</a>(in unsigned long index);
+ boolean <a href="#hastoken" title=dom-tokenlist-has>has</a>(in DOMString token);
+ void <a href="#addtoken" title=dom-tokenlist-add>add</a>(in DOMString token);
+ void <a href="#remove0" title=dom-tokenlist-remove>remove</a>(in DOMString token);
+ boolean <a href="#toggle" title=dom-tokenlist-toggle>toggle</a>(in DOMString token);
+};</pre>
+
+ <p>The <dfn id=length2 title=dom-tokenlist-length><code>length</code></dfn>
+ attribute must return the number of <em>unique</em> tokens that result
+ from <a href="#split" title="split a string on spaces">splitting the
+ underlying string on spaces</a>.
+
+ <p>The <dfn id=itemindex2 title=dom-tokenlist-item><code>item(<var
+ title="">index</var>)</code></dfn> method must <a href="#split"
+ title="split a string on spaces">split the underlying string on
+ spaces</a>, sort the resulting list of tokens by Unicode
+ codepoint<!-- XXX that's
+ basically nonsense. What sort order do we want here? It should be
+ the cheapest one possible that is well-defined for all Unicode. -->,
+ remove exact duplicates, and then return the <var title="">index</var>th
+ item in this list. If <var title="">index</var> is equal to or greater
+ than the number of tokens, then the method must return null.
+
+ <p>The <dfn id=hastoken title=dom-tokenlist-has><code>has(<var
+ title="">token</var>)</code></dfn> method must run the following
+ algorithm:
+
+ <ol>
+ <li>If the <var title="">token</var> argument contains any <a
+ href="#space" title="space character">space characters</a>, then raise an
+ <code>INVALID_CHARACTER_ERR</code> exception and stop the algorithm.
+
+ <li>Otherwise, <a href="#split" title="split a string on spaces">split the
+ underlying string on spaces</a> to get the list of tokens in the object's
+ underlying string.
+
+ <li>If the token indicated by <var title="">token</var> is one of the
+ tokens in the object's underlying string then return true and stop this
+ algorithm.
+
+ <li>Otherwise, return false.
+ </ol>
+
+ <p>The <dfn id=addtoken title=dom-tokenlist-add><code>add(<var
+ title="">token</var>)</code></dfn> method must run the following
+ algorithm:
+
+ <ol>
+ <li>If the <var title="">token</var> argument contains any <a
+ href="#space" title="space character">space characters</a>, then raise an
+ <code>INVALID_CHARACTER_ERR</code> exception and stop the algorithm.
+
+ <li>Otherwise, <a href="#split" title="split a string on spaces">split the
+ underlying string on spaces</a> to get the list of tokens in the object's
+ underlying string.
+
+ <li>If the given <var title="">token</var> is already one of the tokens in
+ the <code><a href="#domtokenlist0">DOMTokenList</a></code> object's
+ underlying string then stop the algorithm.
+
+ <li>Otherwise, if the <code><a
+ href="#domtokenlist0">DOMTokenList</a></code> object's underlying string
+ is not the empty string and the last character of that string is not a <a
+ href="#space">space character</a>, then append a U+0020 SPACE character
+ to the end of that string.
+
+ <li>Append the value of <var title="">token</var> to the end of the
+ <code><a href="#domtokenlist0">DOMTokenList</a></code> object's
+ underlying string.
+ </ol>
+
+ <p>The <dfn id=remove0 title=dom-tokenlist-remove><code>remove(<var
+ title="">token</var>)</code></dfn> method must run the following
+ algorithm:
+
+ <ol>
+ <li>If the <var title="">token</var> argument contains any <a
+ href="#space" title="space character">space characters</a>, then raise an
+ <code>INVALID_CHARACTER_ERR</code> exception and stop the algorithm.
+
+ <li>Otherwise, <a href="#remove" title="remove a token from a
+ string">remove the given <var title="">token</var> from the underlying
+ string</a>.
+ </ol>
+
+ <p>The <dfn id=toggle title=dom-tokenlist-toggle><code>toggle(<var
+ title="">token</var>)</code></dfn> method must run the following
+ algorithm:
+
+ <ol>
+ <li>If the <var title="">token</var> argument contains any <a
+ href="#space" title="space character">space characters</a>, then raise an
+ <code>INVALID_CHARACTER_ERR</code> exception and stop the algorithm.
+
+ <li>Otherwise, <a href="#split" title="split a string on spaces">split the
+ underlying string on spaces</a> to get the list of tokens in the object's
+ underlying string.
+
+ <li>If the given <var title="">token</var> is already one of the tokens in
+ the <code><a href="#domtokenlist0">DOMTokenList</a></code> object's
+ underlying string then <a href="#remove" title="remove a token from a
+ string">remove the given <var title="">token</var> from the underlying
+ string</a>, and stop the algorithm, returning false.
+
+ <li>Otherwise, if the <code><a
+ href="#domtokenlist0">DOMTokenList</a></code> object's underlying string
+ is not the empty string and the last character of that string is not a <a
+ href="#space">space character</a>, then append a U+0020 SPACE character
+ to the end of that string.
+
+ <li>Append the value of <var title="">token</var> to the end of the
+ <code><a href="#domtokenlist0">DOMTokenList</a></code> object's
+ underlying string.
+
+ <li>Return true.
+ </ol>
+
+ <p>Objects implementing the <code><a
+ href="#domtokenlist0">DOMTokenList</a></code> interface must <dfn
+ id=stringify title=dom-tokenlist-toString>stringify</dfn> to the object's
+ underlying string representation.
+
+ <h4 id=domstringmap><span class=secno>2.8.4 </span>DOMStringMap</h4>
+
+ <p>The <code><a href="#domstringmap0">DOMStringMap</a></code> interface
+ represents a set of name-value pairs. When a <code><a
+ href="#domstringmap0">DOMStringMap</a></code> object is instanced, it is
+ associated with three algorithms, one for getting values from names, one
+ for setting names to certain values, and one for deleting names.
+
+ <p class=big-issue>The names of the methods on this interface are temporary
+ and will be fixed when the Web IDL / "Language Bindings for DOM
+ Specifications" spec is ready to handle this case.
+
+ <pre class=idl>interface <dfn id=domstringmap0>DOMStringMap</dfn> {
+ [NameGetter] DOMString <a href="#xxx1name" title=dom-stringmap-XXX1>XXX1</a>(in DOMString name); <!-- XXX DOMB -->
+ [NameSetter] void <a href="#xxx2name" title=dom-stringmap-XXX2>XXX2</a>(in DOMString name, in DOMString value); <!-- XXX DOMB -->
+ [XXX] boolean <a href="#xxx3name" title=dom-stringmap-XXX3>XXX3</a>(in DOMString name); <!-- XXX DOMB -->
+};</pre>
+
+ <p>The <dfn id=xxx1name title=dom-stringmap-XXX1><code>XXX1(<var
+ title="">name</var>)</code></dfn> method must call the algorithm for
+ getting values from names, passing <var title="">name</var> as the name,
+ and must return the corresponding value, or null if <var
+ title="">name</var> has no corresponding value.
+
+ <p>The <dfn id=xxx2name title=dom-stringmap-XXX2><code>XXX2(<var
+ title="">name</var>, <var title="">value</var>)</code></dfn> method must
+ call the algorithm for setting names to certain values, passing <var
+ title="">name</var> as the name and <var title="">value</var> as the
+ value.
+
+ <p>The <dfn id=xxx3name title=dom-stringmap-XXX3><code>XXX3(<var
+ title="">name</var>)</code></dfn> method must call the algorithm for
+ deleting names, passing <var title="">name</var> as the name, and must
+ return true.
+
+ <h4 id=dom-feature><span class=secno>2.8.5 </span>DOM feature strings</h4>
+
+ <p>DOM3 Core defines mechanisms for checking for interface support, and for
+ obtaining implementations of interfaces, using <a
+ href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMFeatures">feature
+ strings</a>. <a href="#refsDOM3CORE">[DOM3CORE]</a>
+
+ <p>A DOM application can use the <dfn id=hasfeature
+ title=hasFeature><code>hasFeature(<var title="">feature</var>, <var
+ title="">version</var>)</code></dfn> method of the
+ <code>DOMImplementation</code> interface with parameter values "<code
+ title="">HTML</code>" and "<code>5.0</code>" (respectively) to determine
+ whether or not this module is supported by the implementation. In addition
+ to the feature string "<code title="">HTML</code>", the feature string
+ "<code title="">XHTML</code>" (with version string "<code>5.0</code>") can
+ be used to check if the implementation supports XHTML. User agents should
+ respond with a true value when the <code><a
+ href="#hasfeature">hasFeature</a></code> method is queried with these
+ values. Authors are cautioned, however, that UAs returning true might not
+ be perfectly compliant, and that UAs returning false might well have
+ support for features in this specification; in general, therefore, use of
+ this method is discouraged.
+
+ <p>The values "<code title="">HTML</code>" and "<code
+ title="">XHTML</code>" (both with version "<code>5.0</code>") should also
+ be supported in the context of the <code>getFeature()</code> and
+ <code>isSupported()</code> methods, as defined by DOM3 Core.
+
+ <p class=note>The interfaces defined in this specification are not always
+ supersets of the interfaces defined in DOM2 HTML; some features that were
+ formerly deprecated, poorly supported, rarely used or considered
+ unnecessary have been removed. Therefore it is not guaranteed that an
+ implementation that supports "<code title="">HTML</code>"
+ "<code>5.0</code>" also supports "<code title="">HTML</code>"
+ "<code>2.0</code>".
+
<h2 id=dom><span class=secno>3. </span>Semantics and structure of HTML
documents</h2>
@@ -9089,7 +9089,7 @@
address of the document's <a href="#application0">application cache</a> <a
href="#the-manifest" title=concept-appcache-manifest>manifest</a>, if
there is one. If the attribute is present, the attribute's value must be a
- <a href="#valid">valid URL</a>.
+ <a href="#valid8">valid URL</a>.
<p>The <code title=attr-html-manifest><a
href="#manifest">manifest</a></code> attribute only <a
@@ -9250,7 +9250,7 @@
attribute, or both.
<p>The <dfn id=href title=attr-base-href><code>href</code></dfn> content
- attribute, if specified, must contain a <a href="#valid">valid URL</a>.
+ attribute, if specified, must contain a <a href="#valid8">valid URL</a>.
<p>A <code><a href="#base">base</a></code> element, if it has an <code
title=attr-base-href><a href="#href">href</a></code> attribute, must come
@@ -9346,7 +9346,7 @@
<p>The destination of the link is given by the <dfn id=href1
title=attr-link-href><code>href</code></dfn> attribute, which must be
- present and must contain a <a href="#valid">valid URL</a>. If the <code
+ present and must contain a <a href="#valid8">valid URL</a>. If the <code
title=attr-link-href><a href="#href1">href</a></code> attribute is absent,
then the element does not define a link.
@@ -10136,16 +10136,16 @@
attribute must have a value consisting either of:
<ul>
- <li> just a <a href="#valid0">valid non-negative integer</a>, or
+ <li> just a <a href="#valid">valid non-negative integer</a>, or
- <li> a <a href="#valid0">valid non-negative integer</a>, followed by a
+ <li> a <a href="#valid">valid non-negative integer</a>, followed by a
U+003B SEMICOLON (<code title="">;</code>), followed by one or more <a
href="#space" title="space character">space characters</a>, followed by
either a U+0055 LATIN CAPITAL LETTER U or a U+0075 LATIN SMALL LETTER
U, a U+0052 LATIN CAPITAL LETTER R or a U+0072 LATIN SMALL LETTER R, a
U+004C LATIN CAPITAL LETTER L or a U+006C LATIN SMALL LETTER L, a
U+003D EQUALS SIGN (<code title="">=</code>), and then a <a
- href="#valid">valid URL</a>.
+ href="#valid8">valid URL</a>.
</ul>
<p>In the former case, the integer represents a number of seconds before
@@ -11928,7 +11928,7 @@
title=attr-blockquote-cite><code>cite</code></dfn> attribute.
<p>If the <code title=attr-blockquote-cite><a href="#cite">cite</a></code>
- attribute is present, it must be a <a href="#valid">valid URL</a>. User
+ attribute is present, it must be a <a href="#valid8">valid URL</a>. User
agents should allow users to follow such citation links.
<p>If a <code><a href="#blockquote">blockquote</a></code> element is <a
@@ -12000,7 +12000,7 @@
attribute is omitted, the list is an ascending list (1, 2, 3, ...).
<p>The <dfn id=start0 title=attr-ol-start><code>start</code></dfn>
- attribute, if present, must be a <a href="#valid1">valid integer</a>
+ attribute, if present, must be a <a href="#valid0">valid integer</a>
giving the ordinal value of the first list item.
<p>If the <code title=attr-ol-start><a href="#start0">start</a></code>
@@ -12185,7 +12185,7 @@
element.
<p>The <dfn id=value title=attr-li-value><code>value</code></dfn>
- attribute, if present, must be a <a href="#valid1">valid integer</a>
+ attribute, if present, must be a <a href="#valid0">valid integer</a>
giving the ordinal value of the list item.
<p>If the <code title=attr-li-value><a href="#value">value</a></code>
@@ -12758,7 +12758,7 @@
<dfn id=cite1 title=attr-q-cite><code>cite</code></dfn> attribute.
<p>If the <code title=attr-q-cite><a href="#cite1">cite</a></code>
- attribute is present, it must be a <a href="#valid">valid URL</a>. User
+ attribute is present, it must be a <a href="#valid8">valid URL</a>. User
agents should allow users to follow such citation links.
<p>If a <code><a href="#q">q</a></code> element is contained (directly or
@@ -13677,7 +13677,7 @@
<p><strong>Author requirements</strong>: The <code
title=attr-progress-max><a href="#max">max</a></code> and <code
title=attr-progress-value><a href="#value1">value</a></code> attributes,
- when present, must have values that are <a href="#valid2" title="valid
+ when present, must have values that are <a href="#valid1" title="valid
floating point number">valid floating point numbers</a>. The <code
title=attr-progress-max><a href="#max">max</a></code> attribute, if
present, must have a value greater than zero. The <code
@@ -13892,7 +13892,7 @@
title=attr-meter-max><a href="#max1">max</a></code>, and <code
title=attr-meter-optimum><a href="#optimum">optimum</a></code> attributes
are all optional. When present, they must have values that are <a
- href="#valid2" title="valid floating point number">valid floating point
+ href="#valid1" title="valid floating point number">valid floating point
numbers</a>, and their values must satisfy the following inequalities:
<ul class=brief>
@@ -15138,7 +15138,7 @@
part of that document that discusses the change.
<p>If the <code title=attr-mod-cite><a href="#cite3">cite</a></code>
- attribute is present, it must be a <a href="#valid">valid URL</a> that
+ attribute is present, it must be a <a href="#valid8">valid URL</a> that
explains the change. User agents should allow users to follow such
citation links.
@@ -15148,14 +15148,14 @@
<p>If present, the <code title=attr-mod-datetime><a
href="#datetime1">datetime</a></code> attribute must be a <a
- href="#valid6">valid datetime</a> value.
+ href="#valid5">valid datetime</a> value.
<p>User agents must parse the <code title=attr-mod-datetime><a
href="#datetime1">datetime</a></code> attribute according to the <a
href="#datetime-parser">parse a string as a datetime value</a> algorithm.
If that doesn't return a time, then the modification has no associated
timestamp (the value is non-conforming; it is not a <a
- href="#valid6">valid datetime</a>). Otherwise, the modification is marked
+ href="#valid5">valid datetime</a>). Otherwise, the modification is marked
as having been made at the given datetime. User agents should use the
associated timezone information to determine which timezone to present the
given datetime in.
@@ -15491,7 +15491,7 @@
content</a>.
<p>The <code title=attr-img-src><a href="#src">src</a></code> attribute
- must be present, and must contain a <a href="#valid">valid URL</a>
+ must be present, and must contain a <a href="#valid8">valid URL</a>
referencing a non-interactive, optionally animated, image resource that is
neither paged nor scripted.
@@ -16203,7 +16203,7 @@
<p>The <dfn id=src1 title=attr-iframe-src><code>src</code></dfn> attribute
gives the address of a page that the nested <a href="#browsing1">browsing
context</a> is to contain. The attribute, if present, must be a <a
- href="#valid">valid URL</a>. When the browsing context is created, if the
+ href="#valid8">valid URL</a>. When the browsing context is created, if the
attribute is present, the user agent must <a href="#navigate">navigate</a>
the element's browsing context to the given <a href="#url">URL</a>, with
<a href="#replacement">replacement enabled</a>, and with the <code><a
@@ -16638,7 +16638,7 @@
<p>The <dfn id=src3 title=attr-embed-src><code>src</code></dfn> attribute
gives the address of the resource being embedded. The attribute, if
- present, must contain a <a href="#valid">valid URL</a>.
+ present, must contain a <a href="#valid8">valid URL</a>.
<p>The <dfn id=type4 title=attr-embed-type><code>type</code></dfn>
attribute, if present, gives the MIME type of the plugin to instantiate.
@@ -16851,7 +16851,7 @@
<p>The <dfn id=data title=attr-object-data><code>data</code></dfn>
attribute, if present, specifies the address of the resource. If present,
- the attribute must be a <a href="#valid">valid URL</a>.
+ the attribute must be a <a href="#valid8">valid URL</a>.
<p>The <dfn id=type6 title=attr-object-type><code>type</code></dfn>
attribute, if present, specifies the type of the resource. If present, the
@@ -17321,8 +17321,8 @@
<p>The <dfn id=poster title=attr-video-poster><code>poster</code></dfn>
attribute gives the address of an image file that the user agent can show
while no video data is available. The attribute, if present, must contain
- a <a href="#valid">valid URL</a>. If the specified resource is to be used,
- it must be fetched when the element is created or when the <code
+ a <a href="#valid8">valid URL</a>. If the specified resource is to be
+ used, it must be fetched when the element is created or when the <code
title=attr-video-poster><a href="#poster">poster</a></code> attribute is
set. The <dfn id=poster0>poster frame</dfn> is then the image obtained
from that resource, if any.</p>
@@ -17727,7 +17727,7 @@
<p>The <dfn id=src5 title=attr-source-src><code>src</code></dfn> attribute
gives the address of the <a href="#media10">media resource</a>. The value
- must be a <a href="#valid">valid URL</a>. This attribute must be present.
+ must be a <a href="#valid8">valid URL</a>. This attribute must be present.
<p>The <dfn id=type8 title=attr-source-type><code>type</code></dfn>
attribute gives the type of the <a href="#media10">media resource</a>, to
@@ -17873,7 +17873,7 @@
href="#media10" title="media resource">media resources</a> that do not
self-describe their <a href="#adjusted1"
title=concept-video-adjusted-ratio>pixel ratio</a>. The attribute value,
- if specified, must be a <a href="#valid2">valid floating point number</a>
+ if specified, must be a <a href="#valid1">valid floating point number</a>
giving the ratio of the correct rendered width of each pixel to the actual
height of each pixel in the image. The default value, if the attribute is
omitted or cannot be parsed, is 1.0.
@@ -18076,7 +18076,7 @@
<p>The <dfn id=src7 title=attr-media-src><code>src</code></dfn> content
attribute on <a href="#media7" title="media element">media elements</a>
gives the address of the media resource (video, audio) to show. The
- attribute, if present, must contain a <a href="#valid">valid URL</a>.
+ attribute, if present, must contain a <a href="#valid8">valid URL</a>.
<p>If the <code title=attr-media-src><a href="#src7">src</a></code>
attribute of a <a href="#media7">media element</a> that is already in a
@@ -20276,7 +20276,7 @@
to control the size of the coordinate space: <dfn id=width0
title=attr-canvas-width><code>width</code></dfn> and <dfn id=height0
title=attr-canvas-height><code>height</code></dfn>. These attributes, when
- specified, must have values that are <a href="#valid0" title="valid
+ specified, must have values that are <a href="#valid" title="valid
non-negative integer">valid non-negative integers</a>. The <a
href="#rules">rules for parsing non-negative integers</a> must be used to
obtain their numeric values. If an attribute is missing, or if parsing its
@@ -23055,7 +23055,7 @@
href="#rectangle0" title=attr-area-shape-rect>rectangle</a> state.
<p>The <dfn id=coords title=attr-area-coords><code>coords</code></dfn>
- attribute must, if specified, contain a <a href="#valid5">valid list of
+ attribute must, if specified, contain a <a href="#valid4">valid list of
integers</a>. This attribute gives the coordinates for the shape described
by the <code title=attr-area-shape><a href="#shape">shape</a></code>
attribute. The processing for this attribute is described as part of the
@@ -23185,7 +23185,7 @@
<code><a href="#img">img</a></code> or <code><a
href="#object">object</a></code> element. The <code
title=attr-area-usemap>usemap</code> attribute, if specified, must be a <a
- href="#valid8">valid hash-name reference</a> to a <code><a
+ href="#valid7">valid hash-name reference</a> to a <code><a
href="#map">map</a></code> element.
<p>If an <code><a href="#img">img</a></code> element or an <code><a
@@ -23507,7 +23507,7 @@
give the dimensions of the visual content of the element (the width and
height respectively, relative to the nominal direction of the output
medium), in CSS pixels. The attributes, if specified, must have values
- that are <a href="#valid4">valid positive non-zero integers</a>.
+ that are <a href="#valid3">valid positive non-zero integers</a>.
<p>The specified dimensions given may differ from the dimensions specified
in the resource itself, since the resource may have a resolution that
@@ -23923,7 +23923,7 @@
<p>If the <code><a href="#colgroup">colgroup</a></code> element contains no
<code><a href="#col">col</a></code> elements, then the element may have a
<dfn id=span0 title=attr-colgroup-span><code>span</code></dfn> content
- attribute specified, whose value must be a <a href="#valid0">valid
+ attribute specified, whose value must be a <a href="#valid">valid
non-negative integer</a> greater than zero.
<p>The <code><a href="#colgroup">colgroup</a></code> element and its <code
@@ -23977,7 +23977,7 @@
<p>The element may have a <dfn id=span2
title=attr-col-span><code>span</code></dfn> content attribute specified,
- whose value must be a <a href="#valid0">valid non-negative integer</a>
+ whose value must be a <a href="#valid">valid non-negative integer</a>
greater than zero.
<p>The <code><a href="#col">col</a></code> element and its <code
@@ -24450,13 +24450,13 @@
<p>The <code><a href="#td">td</a></code> and <code><a
href="#th">th</a></code> elements may have a <dfn id=colspan
title=attr-tdth-colspan><code>colspan</code></dfn> content attribute
- specified, whose value must be a <a href="#valid0">valid non-negative
+ specified, whose value must be a <a href="#valid">valid non-negative
integer</a> greater than zero.
<p>The <code><a href="#td">td</a></code> and <code><a
href="#th">th</a></code> elements may also have a <dfn id=rowspan
title=attr-tdth-rowspan><code>rowspan</code></dfn> content attribute
- specified, whose value must be a <a href="#valid0">valid non-negative
+ specified, whose value must be a <a href="#valid">valid non-negative
integer</a>.
<p>The <code><a href="#td">td</a></code> and <code><a
@@ -25557,7 +25557,7 @@
<p>The <dfn id=src9 title=attr-script-src><code>src</code></dfn> attribute,
if specified, gives the address of the external script resource to use.
- The value of the attribute must be a <a href="#valid">valid URL</a>
+ The value of the attribute must be a <a href="#valid8">valid URL</a>
identifying a script resource of the type given by the <code
title=attr-script-type><a href="#type11">type</a></code> attribute, if the
attribute is present, or of the type "<code
@@ -26194,7 +26194,7 @@
represents a target for events generated by a remote server.
<p>The <dfn id=src11 title=attr-eventsource-src><code>src</code></dfn>
- attribute, if specified, must give a <a href="#valid">valid URL</a>
+ attribute, if specified, must give a <a href="#valid8">valid URL</a>
identifying a resource that uses the <code>text/event-stream</code>
format.
@@ -28523,7 +28523,7 @@
<p>The <dfn id=icon title=attr-command-icon><code>icon</code></dfn>
attribute gives a picture that represents the command. If the attribute is
- specified, the attribute's value must contain a <a href="#valid">valid
+ specified, the attribute's value must contain a <a href="#valid8">valid
URL</a>.
<p>The <dfn id=hidden title=attr-command-hidden><code>hidden</code></dfn>
@@ -29969,7 +29969,7 @@
processing model is to be applied to that element.
<p>The <code title=attr-template><a href="#template">template</a></code>
- attribute, when specified, must be a <a href="#valid">valid URL</a> to an
+ attribute, when specified, must be a <a href="#valid8">valid URL</a> to an
XML or HTML document, or a fragment identifier pointing at another part of
the document. If there is a fragment identifier present, then the element
with that ID in the target document must be a <code><a
@@ -29985,7 +29985,7 @@
<p>The <dfn id=ref title=attr-ref><code>ref</code></dfn> attribute may be
specified on any element on which the <code title=attr-template><a
href="#template">template</a></code> attribute is specified. If it is
- specified, it must be a <a href="#valid">valid URL</a> to an XML or HTML
+ specified, it must be a <a href="#valid8">valid URL</a> to an XML or HTML
document, or a fragment identifier pointing at another part of the
document.
@@ -31315,9 +31315,9 @@
<p>The method has four arguments, though they are all optional.
<p>The first argument, <var title="">url</var>, must be a <a
- href="#valid">valid URL</a> for a page to load in the browsing context. If
- no arguments are provided, or if the first argument is the empty string,
- then the <var title="">url</var> argument defaults to
+ href="#valid8">valid URL</a> for a page to load in the browsing context.
+ If no arguments are provided, or if the first argument is the empty
+ string, then the <var title="">url</var> argument defaults to
"<code>about:blank</code><!-- XXX xref -->". The argument must be <a
href="#resolve" title="resolve a url">resolved</a> to an <a
href="#absolute">absolute URL</a> (or an error) when the method is
@@ -33546,16 +33546,16 @@
<p>When the current section is the explicit section or the online
whitelist section, data lines must consist of zero or more U+0020 SPACE
and U+0009 CHARACTER TABULATION (tab) characters, a <a
- href="#valid">valid URL</a> identifying a resource other than the
+ href="#valid8">valid URL</a> identifying a resource other than the
manifest itself, and then zero or more U+0020 SPACE and U+0009 CHARACTER
TABULATION (tab) characters.</p>
<p>When the current section is the fallback section, data lines must
consist of zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION
- (tab) characters, a <a href="#valid">valid URL</a> identifying a
+ (tab) characters, a <a href="#valid8">valid URL</a> identifying a
resource other than the manifest itself, one or more U+0020 SPACE and
U+0009 CHARACTER TABULATION (tab) characters, another <a
- href="#valid">valid URL</a> identifying a resource other than the
+ href="#valid8">valid URL</a> identifying a resource other than the
manifest itself, and then zero or more U+0020 SPACE and U+0009 CHARACTER
TABULATION (tab) characters.</p>
@@ -37292,8 +37292,8 @@
<p>The <dfn id=href6 title=attr-hyperlink-href><code>href</code></dfn>
attribute on a hyperlink element must have a value that is a <a
- href="#valid">valid URL</a>. This URL is the <em>destination resource</em>
- of the hyperlink.
+ href="#valid8">valid URL</a>. This URL is the <em>destination
+ resource</em> of the hyperlink.
<div class=note>
<p>The <code title=attr-hyperlink-href><a href="#href6">href</a></code>
@@ -38166,7 +38166,7 @@
href="#unordered">unordered set of unique space-separated tokens</a>. The
values must all be either <code title=attr-link-sizes-any><a
href="#any">any</a></code> or a value that consists of two <a
- href="#valid0" title="valid non-negative integer">valid non-negative
+ href="#valid" title="valid non-negative integer">valid non-negative
integers</a> that do not have a leading U+0030 DIGIT ZERO (0) character
and that are separated by a single U+0078 LATIN SMALL LETTER X character.
@@ -38949,7 +38949,7 @@
<p>The <code title=attr-tabindex><a href="#tabindex">tabindex</a></code>
attribute, if specified, must have a value that is a <a
- href="#valid1">valid integer</a>.
+ href="#valid0">valid integer</a>.
<p>If the attribute is specified, it must be parsed using the <a
href="#rules0">rules for parsing integers</a>. The attribute's values have
Modified: source
===================================================================
--- source 2008-08-01 00:46:19 UTC (rev 1969)
+++ source 2008-08-01 05:23:56 UTC (rev 1970)
@@ -995,676 +995,6 @@
- <h3>URLs</h3>
-
- <p>This specification defines the term <span>URL</span>, and defines
- various algorithms for dealing with URLs, because for historical
- reasons the rules defined by the URI and IRI specifications are not
- a complete description of what HTML user agents need to implement to
- be compatible with Web content.</p>
-
-
- <h4>Terminology</h4>
-
- <p>A <dfn>URL</dfn> is a string used to identify a resource. <span
- id="urldoc">A <span>URL</span> is always associated with a
- <code>Document</code>, either explicitly when the URL is created or
- defined; or through a DOM node, in which case the associated
- <code>Document</code> is the node's <code>Document</code>; or
- through a script, in which case the associated <code>Document</code>
- is the script's <span>script document context</span>.</span></p>
-
- <p>A <span>URL</span> is a <dfn>valid URL</dfn> if at least one of
- the following conditions holds:</p>
-
- <ul>
-
- <li><p>The <span>URL</span> is a valid URI reference <a
- href="#refsRFC3986">[RFC3986]</a>.</p></li>
-
- <li><p>The <span>URL</span> is a valid IRI reference and it has no
- query component. <a href="#refsRFC3987">[RFC3987]</a></p></li>
-
- <li><p>The <span>URL</span> is a valid IRI reference and its query
- component contains no unescaped non-ASCII characters. <a
- href="#refsRFC3987">[RFC3987]</a></p></li>
-
- <li><p>The <span>URL</span> is a valid IRI reference and the <span
- title="document's character encoding">character encoding</span> of
- the URL's <code>Document</code> is UTF-8 or UTF-16. <a
- href="#refsRFC3987">[RFC3987]</a></p></li>
-
- </ul>
-
- <p class="note">The term "URL" in this specification is used in a
- manner distinct from the precise technical meaning it is given in
- RFC 3986. Readers familiar with that RFC will find it easier to read
- <em>this</em> specification if they pretend the term "URL" as used
- herein is really called something else altogether.</p>
-
-
- <h4>Parsing URLs</h4>
-
- <p>To <dfn>parse a URL</dfn> <var title="">url</var> into its
- component parts, the user agent must use the following steps:</p>
-
- <ol>
-
- <li><p>Strip leading and trailing <span title="space
- character">space characters</span> from <var
- title="">url</var>.</p></li>
-
- <li>
-
- <p>Parse <var title="">url</var> in the manner defined by RFC
- 3986, with the following exceptions:</p>
-
- <ul>
-
- <li>Add all characters with codepoints less than or equal to
- U+0020 or greater than or equal to U+007F to the
- <unreserved> production.</li>
-
- <li>Add the characters U+0022, U+003C, U+003E, U+005B .. U+005E,
- U+0060, and U+007B .. U+007D to the <unreserved>
- production.
- <!--
- 0022 QUOTATION MARK
- 003C LESS-THAN SIGN
- 003E GREATER-THAN SIGN
- 005B LEFT SQUARE BRACKET
- 005C REVERSE SOLIDUS
- 005D RIGHT SQUARE BRACKET
- 005E CIRCUMFLEX ACCENT
- 0060 GRAVE ACCENT
- 007B LEFT CURLY BRACKET
- 007C VERTICAL LINE
- 007D RIGHT CURLY BRACKET
- -->
- </li>
-
- <li>Add a single U+0025 PERCENT SIGN character as a second
- alternative way of matching the <pct-encoded> production,
- except when the <pct-encoded> is used in the
- <reg-name> production.</li>
-
- <li>Add the U+0023 NUMBER SIGN character to the characters
- allowed in the <fragment> production.</li>
-
- <!-- some browsers also have other differences, e.g. Mozilla
- seems to treat ";" as if it was not in sub-delims, if the scheem
- is "ftp". -->
-
- </ul>
-
- </li>
-
- <li>
-
- <p>If <var title="">url</var> doesn't match the
- <URI-reference> production, even after the above changes are
- made to the ABNF definitions, then parsing the URL fails with an
- error. <a href="#refsRFC3986">[RFC3986]</a></p>
-
- <p>Otherwise, parsing <var title="">url</var> was successful; the
- components of the URL are substrings of <var title="">url</var>
- defined as follows:</p>
-
- <dl>
-
- <dt><dfn title="url-scheme"><scheme></dfn></dt>
-
- <dd><p>The substring matched by the <scheme> production, if any.</p></dd>
-
-
- <dt><dfn title="url-host"><host></dfn></dt>
-
- <dd><p>The substring matched by the <host> production, if any.</p></dd>
-
-
- <dt><dfn title="url-port"><port></dfn></dt>
-
- <dd><p>The substring matched by the <port> production, if any.</p></dd>
-
-
- <dt><dfn title="url-hostport"><hostport></dfn></dt>
-
- <dd><p>If there is a <scheme> component and a <port>
- component and the port given by the <port> component is
- different than the default port defined for the protocol given by
- the <scheme> component, then <hostport> is the
- substring that starts with the substring matched by the
- <host> production and ends with the substring matched by the
- <port> production, and includes the colon in between the
- two. Otherwise, it is the same as the <host> component.</p>
-
-
- <dt><dfn title="url-path"><path></dfn></dt>
-
- <dd>
-
- <p>The substring matched by one of the following productions, if
- one of them was matched:</p>
-
- <ul class="brief">
- <li><path-abempty></li>
- <li><path-absolute></li>
- <li><path-noscheme></li>
- <li><path-rootless></li>
- <li><path-empty></li>
- </ul>
-
- </dd>
-
-
- <dt><dfn title="url-query"><query></dfn></dt>
-
- <dd><p>The substring matched by the <query> production, if any.</p></dd>
-
-
- <dt><dfn title="url-fragment"><fragment></dfn></dt>
-
- <dd><p>The substring matched by the <fragment> production, if any.</p></dd>
-
- </dl>
-
- </li>
-
- </ol>
-
- <!-- XXX we might want to define "server-based naming authority",
- it's not clear RFC3986 does a good job of defining that anymore
- (earlier URI specs did) -->
-
-
- <h4>Resolving URLs</h4>
-
- <p>Relative URLs are resolved relative to a base URL. The <dfn>base
- URL</dfn> of a <span>URL</span> is the <span>absolute URL</span>
- obtained as follows:</p>
-
- <dl class="switch">
-
- <dt>If the URL to be resolved was passed to an API</dt>
-
- <dd><p>The base URL is the <span>document base URL</span> of the
- script's <span>script document context</span>.</p></dd>
-
- <dt>If the URL to be resolved is from the value of a content
- attribute</dt>
-
- <dd>
-
- <p>The base URL is the <i>base URI of the element</i> that the
- attribute is on, as defined by the XML Base specification, with
- <i>the base URI of the document entity</i> being defined as the
- <span>document base URL</span> of the <code>Document</code> that
- owns the element.</p>
-
- <p>For the purposes of the XML Base specification, user agents
- must act as if all <code>Document</code> objects represented XML
- documents.</p>
-
- <p class="note">It is possible for <code
- title="attr-xml-base">xml:base</code> attributes to be present
- even in HTML fragments, as such attributes can be added
- dynamically using script. (Such scripts would not be conforming,
- however, as <code title="attr-xml-base">xml:base</code> attributes
- are not allowed in <span>HTML documents</span>.)</p>
-
- </dd>
-
- <dt>If the URL to be resolved was found in an offline application
- cache manifest</dt>
-
- <dd><p>The base URL is the URL of the <span>application
- cache</span> <span
- title="concept-appcache-manifest">manifest</span>.</p></dd>
-
- </dl>
-
- <p>The <dfn>document base URL</dfn> of a <code>Document</code> is
- the <span>absolute URL</span> obtained by running these steps:</p>
-
- <ol>
-
- <li><p>If there is no <code>base</code> element that is both a
- child of <span>the <code>head</code> element</span> and has an
- <code title="attr-base-href">href</code> attribute, then the
- <span>document base URL</span> is <span>the document's
- address</span><!-- XXXDOCURL -->.</p></li>
-
- <li><p>Otherwise, let <var title="">url</var> be the value of the
- <code title="attr-base-href">href</code> attribute of the first such
- element.</p></li>
-
- <li><p><span title="resolve a URL">Resolve</span> the <var
- title="">url</var> URL, using <span>the document's
- address</span><!-- XXXDOCURL --> as the <span>base URL</span>
- (thus, the <code>base</code> <code
- title="attr-base-href">href</code> attribute isn't affect by <code
- title="attr-xml-base">xml:base</code> attributes).</p></li>
-
- <li><p>The <span>document base URL</span> is the result of the
- previous step if it was successful; otherwise it is <span>the
- document's address</span><!-- XXXDOCURL -->.</p></li>
-
- </ol>
-
- <p>To <dfn>resolve a URL</dfn> to an <span>absolute URL</span> the
- user agent must use the following steps. Resolving a URL can result
- in an error, in which case the URL is not resolvable.</p>
-
- <ol>
-
- <li><p>Let <var title="">url</var> be the <span>URL</span> being
- resolved.</p></li>
-
- <li><p>Let <var title="">document</var> be the
- <code>Document</code> <a href="#urldoc">associated with</a> <var
- title="">url</var>.</p></li>
-
- <li><p>Let <var title="">encoding</var> be the <span
- title="document's character encoding">character encoding</span> of
- <var title="">document</var>.</p></li>
-
- <li><p>If <var title="">encoding</var> is UTF-16, then change it to
- UTF-8.</p></li>
-
- <li><p>Let <var title="">base</var> be the <span>base URL</span>
- for <var title="">url</var>. (This is an <span>absolute
- URL</span>.)</p></li>
-
- <li><p><span title="parse a URL">Parse</span> <var
- title="">url</var> into its component parts.</p></li>
-
- <li>
-
- <p>If parsing <var title="">url</var> resulted in a <span
- title="url-host"><host></span> component, then replace the
- matching subtring of <var title="">url</var> with the string that
- results from expanding any sequences of percent-encoded octets in
- that component that are valid UTF-8 sequences into Unicode
- characters as defined by UTF-8.</p>
-
- <p>If any percent-encoded octets in that component are not valid
- UTF-8 sequences, then return an error and abort these steps.</p>
-
- <p>Apply the IDNA ToASCII algorithm to the matching substring,
- with both the AllowUnassigned and UseSTD3ASCIIRules flags
- set. Replace the matching substring with the result of the ToASCII
- algorithm.</p>
-
- <p>If ToASCII fails to convert one of the components of the
- string, e.g. because it is too long or because it contains invalid
- characters, then return an error and abort these steps. <a
- href="#refsRFC3490">[RFC3490]</a></p>
-
- </li>
-
- <li>
-
- <p>If parsing <var title="">url</var> resulted in a <span
- title="url-path"><path></span> component, then replace the
- matching substring of <var title="">url</var> with the string that
- results from applying the following steps to each character other
- than U+0025 PERCENT SIGN (%) that doesn't match the original
- <path> production defined in RFC 3986:</p>
-
- <ol>
-
- <li>Encode the character into a sequence of octets as defined by
- UTF-8.</li>
-
- <li>Replace the character with the percent-encoded form of those
- octets. <a href="#refsRFC3986">[RFC3986]</a></li>
-
- </ol>
-
- <div class="example">
-
- <p>For instance if <var title="">url</var> was "<code
- title="">//example.com/a^b☺c%FFd%z/?e</code>", then the
- <span title="url-path"><path></span> component's substring
- would be "<code title="">/a^b☺c%FFd%z/</code>" and the two
- characters that would have to be escaped would be "<code
- title="">^</code>" and "<code title="">☺</code>". The
- result after this step was applied would therefore be that <var
- title="">url</var> now had the value "<code
- title="">//example.com/a%5Eb%E2%98%BAc%FFd%z/?e</code>".</p>
-
- </div>
-
- </li>
-
- <li>
-
- <p>If parsing <var title="">url</var> resulted in a <span
- title="url-query"><query></span> component, then replace the
- matching substring of <var title="">url</var> with the string that
- results from applying the following steps to each character other
- than U+0025 PERCENT SIGN (%) that doesn't match the original
- <query> production defined in RFC 3986:</p>
-
- <ol>
-
- <li>If the character in question cannot be expressed in the
- encoding <var title="">encoding</var>, then replace it with a
- single 0x3F octet (an ASCII question mark) and skip the remaining
- substeps for this character.</li>
-
- <li>Encode the character into a sequence of octets as defined by
- the encoding <var title="">encoding</var>.</li>
-
- <li>Replace the character with the percent-encoded form of those
- octets. <a href="#refsRFC3986">[RFC3986]</a></li>
-
- </ol>
-
- </li>
-
- <li><p>Apply the algorithm described in RFC 3986 section 5.2
- Relative Resolution, using <var title="">url</var> as the
- potentially relative URI reference (<var title="">R</var>), and
- <var title="">base</var> as the base URI (<var
- title="">Base</var>). <a href="#refsRFC3986">[RFC3986]</a></p></li>
-
- <li>
-
- <p>Apply any relevant conformance criteria of RFC 3986 and RFC
- 3987, returning an error and aborting these steps if
- appropriate. <a href="#refsRFC3986">[RFC3986]</a> <a
- href="#refsRFC3987">[RFC3987]</a></p>
-
- <p class="example">For instance, if an absolute URI that would be
- returned by the above algorithm violates the restrictions specific
- to its scheme, e.g. a <code title="">data:</code> URI using the
- "<code title="">//</code>" server-based naming authority syntax,
- then user agents are to treat this as an error instead.<!-- RFC
- 3986, 3.1 Scheme --></p>
-
- </li>
-
- <li><p>Let <var title="">result</var> be the target URI (<var
- title="">T</var>) returned by the Relative Resolution
- algorithm.</p></li>
-
- <li><p>If <var title="">result</var> uses a scheme with a
- server-based naming authority, replace all U+005C REVERSE SOLIDUS
- (\) characters in <var title="">result</var> with U+002F SOLIDUS
- (/) characters.</p></li>
-
- <li><p>Return <var title="">result</var>.</p></li>
-
- </ol>
-
- <p>A <span>URL</span> is an <dfn>absolute URL</dfn> if <span
- title="resolve a URL">resolving</span> it results in the same
- URL without an error.</p>
-
-
- <h4>Dynamic changes to base URLs</h4>
-
- <p>When an <code title="attr-xml-base">xml:base</code> attribute
- changes, the attribute's element, and all descendant elements, are
- <span>affected by a base URL change</span>.</p>
-
- <p>When a document's <span>document base URL</span> changes, all
- elements in that document are <span>affected by a base URL
- change</span>.</p>
-
- <p>When an element is moved from one document to another, if the two
- documents have different <span title="document base URL">base
- URLs</span>, then that element and all its descendants are
- <span>affected by a base URL change</span>.</p>
-
- <p>When an element is <dfn>affected by a base URL change</dfn>, it
- must act as described in the following list:</p>
-
- <dl class="switch">
-
- <dt>If the element is a <span title="hyperlink">hyperlink
- element</span></dt>
-
- <dd>
-
- <p>If the <span>absolute URL</span> identified by the hyperlink is
- being shown to the user, or if any data derived from that URL is
- affecting the display, then the <code
- title="attr-hyperlink-href">href</code> attribute should be <span
- title="resolve a url">reresolved</span> and the UI updated
- appropriately.</p>
-
- <p class="example">For example, the CSS <code
- title="">:link</code>/<code title="">:visited</code>
- pseudo-classes might have been affected.</p>
-
- <p>If the hyperlink has a <code
- title="attr-hyperlink-ping">ping</code> attribute and its <span
- title="absolute URL">absolute URL(s)</span> are being shown to the
- user, then the <code title="attr-hyperlink-ping">ping</code>
- attribute's tokens should be <span title="resolve a
- url">reresolved</span> and the UI updated appropriately.</p>
-
- </dd>
-
- <dt>If the element is a <code>blockquote</code>, <code>q</code>,
- <code>ins</code>, or <code>del</code> element with a <code
- title="">cite</code> attribute</dt>
-
- <dd>
-
- <p>If the <span>absolute URL</span> identified by the <code
- title="">cite</code> attribute is being shown to the user, or if
- any data derived from that URL is affecting the display, then the
- it should be <span title="resolve a url">reresolved</span> and the
- UI updated appropriately.</p>
-
- </dd>
-
- <dt>Otherwise</dt>
-
- <dd>
-
- <p>The element is not directly affected.</p>
-
- <p class="example">Changing the base URL doesn't affect the image
- displayed by <code>img</code> elements, although subsequent
- accesses of the <code title="dom-img-src">src</code> DOM attribute
- from script will return a new <span>absolute URL</span> that might
- no longer correspond to the image being shown.</p>
-
- </dd>
-
- </dl>
-
-
-
-
-
- <h4>Interfaces for URL manipulation</h4>
-
- <p>An interface that has a complement of <dfn>URL decomposition
- attributes</dfn> will have seven attributes with the following
- definitions:</p>
-
-<pre class="idl">
- attribute DOMString <span title="dom-uda-protocol">protocol</span>;
- attribute DOMString <span title="dom-uda-host">host</span>;
- attribute DOMString <span title="dom-uda-hostname">hostname</span>;
- attribute DOMString <span title="dom-uda-port">port</span>;
- attribute DOMString <span title="dom-uda-pathname">pathname</span>;
- attribute DOMString <span title="dom-uda-search">search</span>;
- attribute DOMString <span title="dom-uda-hash">hash</span>;
-</pre>
-
- <p>The attributes defined to be URL decomposition attributes must
- act as described for the attributes with the same corresponding
- names in this section.</p>
-
- <p>In addition, an interface with a complement of URL decomposition
- attributes will define an <dfn
- title="concept-uda-input">input</dfn>, which is a <span>URL</span>
- that the attributes act on, and a <dfn
- title="concept-uda-setter">common setter action</dfn>, which is a
- set of steps invoked when any of the attributes' setters are
- invoked.</p>
-
- <p>The seven URL decomposition attributes have similar
- requirements.</p>
-
- <p>On getting, if the <span title="concept-uda-input">input</span>
- fulfills the condition given in the "getter condition" column
- corresponding to the attribute in the table below, the user agent
- must return the part of the <span
- title="concept-uda-input">input</span> URL given in the "component"
- column, with any prefixes specified in the "prefix" column
- appropriately added to the start of the string and any suffixes
- specified in the "suffix" column appropriately added to the end of
- the string. Otherwise, the attribute must return the empty
- string.</p>
-
- <p>On setting, the new value must first be mutated as described by
- the "setter preprocessor" column, then mutated by %-escaping any
- characters in the new value that are not valid in the relevant
- component as given by the "component" column. Then, if the resulting
- new value fulfills the condition given in the "setter condition"
- column, the user agent must make a new string <var
- title="">output</var> by replacing the component of the URL given by
- the "component" column in the <span
- title="concept-uda-input">input</span> URL with the new value;
- otherwise, the user agent must let <var title="">output</var> be
- equal to the <span title="concept-uda-input">input</span>. Finally,
- the user agent must invoke the <span
- title="concept-uda-setter">common setter action</span> with the
- value of <var title="">output</var>.</p>
-
- <p>When replacing a component in the URL, if the component is part
- of an optional group in the URL syntax consisting of a character
- followed by the component, the component (including its prefix
- character) must be included even if the new value is the empty
- string.</p>
-
- <p class="note">The previous paragraph applies in particular to the
- "<code title="">:</code>" before a <port> component, the "<code
- title="">?</code>" before a <query> component, and the "<code
- title="">#</code>" before a <fragment> component.</p>
-
- <p>For the purposes of the above definitions, URLs must be parsed
- using the <span title="parse a URL">URL parsing rules</span> defined
- in this specification.</p>
-
- <table>
- <thead>
- <tr>
- <th>Attribute
- <th>Component
- <th>Getter Condition
- <th>Prefix
- <th>Suffix
- <th>Setter Preprocessor
- <th>Setter Condition
- <tbody>
- <tr>
- <td><dfn title="dom-uda-protocol"><code>protocol</code></dfn>
- <td><span title="url-scheme"><scheme></span>
- <td>—
- <td>—
- <td>U+003A COLON ("<code title="">:</code>")
- <td>Remove all trailing U+003A COLON ("<code title="">:</code>") characters
- <td>The new value is not the empty string
- <tr>
- <td><dfn title="dom-uda-host"><code>host</code></dfn>
- <td><span title="url-hostport"><hostport></span>
- <td><span title="concept-uda-input">input</span> is hierarchical and uses a server-based naming authority
- <td>—
- <td>—
- <td>—
- <td>—
- <tr>
- <td><dfn title="dom-uda-hostname"><code>hostname</code></dfn>
- <td><span title="url-host"><host></span>
- <td><span title="concept-uda-input">input</span> is hierarchical and uses a server-based naming authority
- <td>—
- <td>—
- <td>Remove all leading U+002F SOLIDUS ("<code title="">/</code>") characters
- <td>—
- <tr>
- <td><dfn title="dom-uda-port"><code>port</code></dfn>
- <td><span title="url-port"><port></span>
- <td><span title="concept-uda-input">input</span> is hierarchical, uses a server-based naming authority, and contained a <span title="url-port"><port></span> component (possibly an empty one)
- <td>—
- <td>—
- <td>Remove any characters in the new value that are not in the range U+0030 DIGIT ZERO .. U+0039 DIGIT NINE.
- If the resulting string is empty, set it to a single U+0030 DIGIT ZERO character ('0').
- <td>—
- <tr>
- <td><dfn title="dom-uda-pathname"><code>pathname</code></dfn>
- <td><span title="url-path"><path></span>
- <td><span title="concept-uda-input">input</span> is hierarchical
- <td>—
- <td>—
- <td>If it has no leading U+002F SOLIDUS ("<code title="">/</code>") character, prepend a U+002F SOLIDUS ("<code title="">/</code>") character to the new value
- <td>—
- <tr>
- <td><dfn title="dom-uda-search"><code>search</code></dfn>
- <td><span title="url-query"><query></span>
- <td><span title="concept-uda-input">input</span> is hierarchical, and contained a <span title="url-query"><query></span> component (possibly an empty one)
- <td>U+003F QUESTION MARK ("<code title="">?</code>")
- <td>—
- <td>Remove one leading U+003F QUESTION MARK ("<code title="">?</code>") character, if any
- <td>—
- <tr>
- <td><dfn title="dom-uda-hash"><code>hash</code></dfn>
- <td><span title="url-fragment"><fragment></span>
- <td><span title="concept-uda-input">input</span> contained a <span title="url-fragment"><fragment></span> component (possibly an empty one)
- <td>U+0023 NUMBER SIGN ("<code title="">#</code>")
- <td>—
- <td>Remove one leading U+0023 NUMBER SIGN ("<code title="">#</code>") character, if any
- <td>—
- </table>
-
-<!--
- http://www.hixie.ch/tests/adhoc/dom/level0/location/components/
- http://lxr.mozilla.org/seamonkey/source/dom/src/base/nsLocation.cpp
- http://wp.netscape.com/eng/mozilla/3.0/handbook/javascript/ref_h-l.htm#84722
--->
-
- <div class="example">
-
- <p>The table below demonstrates how the getter condition for <code
- title="dom-uda-search">search</code> results in different results
- depending on the exact original syntax of the URL:</p>
-
- <table>
- <thead>
- <tr>
- <th> Input URL
- <th> <code title="dom-uda-search">search</code> value
- <th> Explanation
- <tbody>
- <tr>
- <td> <code title="">http://example.com/</code>
- <td> <i>empty string</i>
- <td> No <span title="url-query"><query></span> component in input URL.
- <tr>
- <td> <code title="">http://example.com/?</code>
- <td> <code title="">?</code>
- <td> There is a <span title="url-query"><query></span> component, but it is empty. The question mark in the resulting value is the prefix.
- <tr>
- <td> <code title="">http://example.com/?test</code>
- <td> <code title="">?test</code>
- <td> The <span title="url-query"><query></span> component has the value "<code title="">test</code>".
- <tr>
- <td> <code title="">http://example.com/?test#</code>
- <td> <code title="">?test</code>
- <td> The (empty) <span title="url-fragment"><fragment></span> component is not part of the <span title="url-query"><query></span> component.
- </table>
-
- </div>
-
-
-
<h3>Common microsyntaxes</h3>
<p>There are various places in HTML that accept particular data
@@ -3428,624 +2758,678 @@
</ol>
- <h3>Common DOM interfaces</h3>
- <h4>Reflecting content attributes in DOM attributes</h4>
- <p>Some <span title="DOM attribute">DOM attributes</span> are
- defined to <dfn>reflect</dfn> a particular <span>content
- attribute</span>. This means that on getting, the DOM attribute
- returns the current value of the content attribute, and on setting,
- the DOM attribute changes the value of the content attribute to the
- given value.</p>
+ <h3>URLs</h3>
- <p>If a reflecting DOM attribute is a <code>DOMString</code>
- attribute whose content attribute is defined to contain a
- <span>URL</span>, then on getting, the DOM attribute must <span
- title="resolve a url">resolve</span> the value of the content
- attribute and return the resulting <span>absolute URL</span> if that
- was successful, or the empty string otherwise; and on setting, must
- set the content attribute to the specified literal value. If the
- content attribute is absent, the DOM attribute must return the
- default value, if the content attribute has one, or else the empty
- string.</p>
+ <p>This specification defines the term <span>URL</span>, and defines
+ various algorithms for dealing with URLs, because for historical
+ reasons the rules defined by the URI and IRI specifications are not
+ a complete description of what HTML user agents need to implement to
+ be compatible with Web content.</p>
- <p>If a reflecting DOM attribute is a <code>DOMString</code>
- attribute whose content attribute is defined to contain one or more
- <span title="URL">URLs</span>, then on getting, the DOM attribute
- must <span title="split the string on spaces">split the content
- attribute on spaces</span> and return the concatenation of <span
- title="resolve a URL">resolving</span> each token URL to an
- <span>absolute URL</span>, with a single U+0020 SPACE character
- between each URL, ignoring any tokens that did not resolve
- successfully. If the content attribute is absent, the DOM attribute
- must return the default value, if the content attribute has one, or
- else the empty string. On setting, the DOM attribute must set the
- content attribute to the specified literal value.</p>
- <p>If a reflecting DOM attribute is a <code>DOMString</code> whose
- content attribute is an <span>enumerated attribute</span>, and the
- DOM attribute is <dfn>limited to only known values</dfn>, then, on
- getting, the DOM attribute must return the conforming value
- associated with the state the attribute is in (in its canonical
- case), or the empty string if the attribute is in a state that has
- no associated keyword value; and on setting, if the new value is an
- <span>ASCII case-insensitive</span> match for one of the keywords
- given for that attribute, then the content attribute must be set to
- the conforming value associated with the state that the attribute
- would be in if set to the given new value, otherwise, if the new
- value is the empty string, then the content attribute must be
- removed, otherwise, the setter must raise a <code>SYNTAX_ERR</code>
- exception.</p>
+ <h4>Terminology</h4>
- <p>If a reflecting DOM attribute is a <code>DOMString</code> but
- doesn't fall into any of the above categories, then the getting and
- setting must be done in a transparent, case-preserving manner.</p>
+ <p>A <dfn>URL</dfn> is a string used to identify a resource. <span
+ id="urldoc">A <span>URL</span> is always associated with a
+ <code>Document</code>, either explicitly when the URL is created or
+ defined; or through a DOM node, in which case the associated
+ <code>Document</code> is the node's <code>Document</code>; or
+ through a script, in which case the associated <code>Document</code>
+ is the script's <span>script document context</span>.</span></p>
- <p>If a reflecting DOM attribute is a boolean attribute, then on
- getting the DOM attribute must return true if the attribute is set,
- and false if it is absent. On setting, the content attribute must be
- removed if the DOM attribute is set to false, and must be set to
- have the same value as its name if the DOM attribute is set to
- true. (This corresponds to the rules for <span title="boolean
- attribute">boolean content attributes</span>.)</p>
+ <p>A <span>URL</span> is a <dfn>valid URL</dfn> if at least one of
+ the following conditions holds:</p>
- <p>If a reflecting DOM attribute is a signed integer type
- (<code>long</code>) then, on getting, the content attribute must be
- parsed according to <span title="rules for parsing integers">the
- rules for parsing signed integers</span>, and if that is successful,
- the resulting value must be returned. If, on the other hand, it
- fails, or if the attribute is absent, then the default value must be
- returned instead, or 0 if there is no default value. On setting, the
- given value must be converted to the shortest possible string
- representing the number as a <span>valid integer</span> in base ten
- and then that string must be used as the new content attribute
- value.</p>
+ <ul>
- <p>If a reflecting DOM attribute is an <em>unsigned</em> integer
- type (<code>unsigned long</code>) then, on getting, the content
- attribute must be parsed according to <span title="rules for parsing
- non-negative integers">the rules for parsing unsigned
- integers</span>, and if that is successful, the resulting value must
- be returned. If, on the other hand, it fails, or if the attribute is
- absent, the default value must be returned instead, or 0 if there is
- no default value. On setting, the given value must be converted to
- the shortest possible string representing the number as a
- <span>valid non-negative integer</span> in base ten and then that
- string must be used as the new content attribute value.</p>
+ <li><p>The <span>URL</span> is a valid URI reference <a
+ href="#refsRFC3986">[RFC3986]</a>.</p></li>
- <p>If a reflecting DOM attribute is an unsigned integer type
- (<code>unsigned long</code>) that is <dfn>limited to only positive
- non-zero numbers</dfn>, then the behavior is similar to the previous
- case, but zero is not allowed. On getting, the content attribute
- must first be parsed according to <span title="rules for parsing
- non-negative integers">the rules for parsing unsigned
- integers</span>, and if that is successful, the resulting value must
- be returned. If, on the other hand, it fails, or if the attribute is
- absent, the default value must be returned instead, or 1 if there is
- no default value. On setting, if the value is zero, the user agent
- must fire an <code>INDEX_SIZE_ERR</code> exception. Otherwise, the
- given value must be converted to the shortest possible string
- representing the number as a <span>valid non-negative integer</span>
- in base ten and then that string must be used as the new content
- attribute value.</p>
+ <li><p>The <span>URL</span> is a valid IRI reference and it has no
+ query component. <a href="#refsRFC3987">[RFC3987]</a></p></li>
- <p>If a reflecting DOM attribute is a floating point number type
- (<code>float</code>) and the content attribute is defined to contain
- a time offset, then, on getting, the content attribute must be
- parsed according to <span title="rules for parsing time offsets">the
- rules for parsing time offsets</span>, and if that is successful, the
- resulting value, in seconds, must be returned. If that fails, or if
- the attribute is absent, the default value must be returned, or the
- not-a-number value (NaN) if there is no default value. On setting,
- the given value, interpreted as a time offset in seconds, must be
- converted to a string using the <span>time offset serialization
- rules</span>, and that string must be used as the new content
- attribute value.</p>
+ <li><p>The <span>URL</span> is a valid IRI reference and its query
+ component contains no unescaped non-ASCII characters. <a
+ href="#refsRFC3987">[RFC3987]</a></p></li>
- <p>If a reflecting DOM attribute is a floating point number type
- (<code>float</code>) and it doesn't fall into one of the earlier
- categories, then, on getting, the content attribute must be parsed
- according to <span title="rules for parsing floating point number
- values">the rules for parsing floating point number values</span>,
- and if that is successful, the resulting value must be returned. If,
- on the other hand, it fails, or if the attribute is absent, the
- default value must be returned instead, or 0.0 if there is no
- default value. On setting, the given value must be converted to the
- shortest possible string representing the number as a <span>valid
- floating point number</span> in base ten and then that string must
- be used as the new content attribute value.</p>
+ <li><p>The <span>URL</span> is a valid IRI reference and the <span
+ title="document's character encoding">character encoding</span> of
+ the URL's <code>Document</code> is UTF-8 or UTF-16. <a
+ href="#refsRFC3987">[RFC3987]</a></p></li>
- <p>If a reflecting DOM attribute is of the type
- <code>DOMTokenList</code>, then on getting it must return a
- <code>DOMTokenList</code> object whose underlying string is the
- element's corresponding content attribute. When the
- <code>DOMTokenList</code> object mutates its underlying string, the
- content attribute must itself be immediately mutated. When the
- attribute is absent, then the string represented by the
- <code>DOMTokenList</code> object is the empty string; when the
- object mutates this empty string, the user agent must first add the
- corresponding content attribute, and then mutate that attribute
- instead. <code>DOMTokenList</code> attributes are always
- read-only. The same <code>DOMTokenList</code> object must be
- returned every time for each attribute.</p>
+ </ul>
- <p>If a reflecting DOM attribute has the type
- <code>HTMLElement</code>, or an interface that descends from
- <code>HTMLElement</code>, then, on getting, it must run the
- following algorithm (stopping at the first point where a value is
- returned):
+ <p class="note">The term "URL" in this specification is used in a
+ manner distinct from the precise technical meaning it is given in
+ RFC 3986. Readers familiar with that RFC will find it easier to read
+ <em>this</em> specification if they pretend the term "URL" as used
+ herein is really called something else altogether.</p>
+
+ <h4>Parsing URLs</h4>
+
+ <p>To <dfn>parse a URL</dfn> <var title="">url</var> into its
+ component parts, the user agent must use the following steps:</p>
+
<ol>
- <li>If the corresponding content attribute is absent, then the
- DOM attribute must return null.</li>
+ <li><p>Strip leading and trailing <span title="space
+ character">space characters</span> from <var
+ title="">url</var>.</p></li>
- <li>Let <var title="">candidate</var> be the element that the <code
- title="">document.getElementById()</code> method would find if it
- was passed as its argument the current value of the corresponding
- content attribute.</li>
+ <li>
- <li>If <var title="">candidate</var> is null, or if it is not
- type-compatible with the DOM attribute, then the DOM attribute must
- return null.</li>
+ <p>Parse <var title="">url</var> in the manner defined by RFC
+ 3986, with the following exceptions:</p>
- <li>Otherwise, it must return <var title="">candidate</var>.</li>
+ <ul>
- </ol>
+ <li>Add all characters with codepoints less than or equal to
+ U+0020 or greater than or equal to U+007F to the
+ <unreserved> production.</li>
- <p>On setting, if the given element has an <code
- title="attr-id">id</code> attribute, then the content attribute must
- be set to the value of that <code title="attr-id">id</code>
- attribute. Otherwise, the DOM attribute must be set to the empty
- string.</p><!-- XXX or raise an exception? -->
+ <li>Add the characters U+0022, U+003C, U+003E, U+005B .. U+005E,
+ U+0060, and U+007B .. U+007D to the <unreserved>
+ production.
+ <!--
+ 0022 QUOTATION MARK
+ 003C LESS-THAN SIGN
+ 003E GREATER-THAN SIGN
+ 005B LEFT SQUARE BRACKET
+ 005C REVERSE SOLIDUS
+ 005D RIGHT SQUARE BRACKET
+ 005E CIRCUMFLEX ACCENT
+ 0060 GRAVE ACCENT
+ 007B LEFT CURLY BRACKET
+ 007C VERTICAL LINE
+ 007D RIGHT CURLY BRACKET
+ -->
+ </li>
+ <li>Add a single U+0025 PERCENT SIGN character as a second
+ alternative way of matching the <pct-encoded> production,
+ except when the <pct-encoded> is used in the
+ <reg-name> production.</li>
+ <li>Add the U+0023 NUMBER SIGN character to the characters
+ allowed in the <fragment> production.</li>
- <h4>Collections</h4>
+ <!-- some browsers also have other differences, e.g. Mozilla
+ seems to treat ";" as if it was not in sub-delims, if the scheem
+ is "ftp". -->
- <p>The <code>HTMLCollection</code>,
- <code>HTMLFormControlsCollection</code>, and
- <code>HTMLOptionsCollection</code> interfaces represent various
- lists of DOM nodes. Collectively, objects implementing these
- interfaces are called <dfn>collections</dfn>.</p>
+ </ul>
- <p>When a <span title="collections">collection</span> is created, a
- filter and a root are associated with the collection.</p>
+ </li>
- <p class="example">For example, when the <code>HTMLCollection</code>
- object for the <code
- title="dom-document-images">document.images</code> attribute is
- created, it is associated with a filter that selects only
- <code>img</code> elements, and rooted at the root of the
- document.</p>
+ <li>
- <p>The <span title="collections">collection</span> then <dfn
- title="represented by the collection">represents</dfn> a
- <span>live</span> view of the subtree rooted at the collection's
- root, containing only nodes that match the given filter. The view is
- linear. In the absence of specific requirements to the contrary, the
- nodes within the collection must be sorted in <span>tree
- order</span>.</p>
+ <p>If <var title="">url</var> doesn't match the
+ <URI-reference> production, even after the above changes are
+ made to the ABNF definitions, then parsing the URL fails with an
+ error. <a href="#refsRFC3986">[RFC3986]</a></p>
- <p class="note">The <code title="dom-table-rows">rows</code> list is
- not in tree order.</p>
+ <p>Otherwise, parsing <var title="">url</var> was successful; the
+ components of the URL are substrings of <var title="">url</var>
+ defined as follows:</p>
- <p>An attribute that returns a collection must return the same
- object every time it is retrieved.</p>
+ <dl>
+ <dt><dfn title="url-scheme"><scheme></dfn></dt>
- <h5>HTMLCollection</h5>
+ <dd><p>The substring matched by the <scheme> production, if any.</p></dd>
- <p>The <code>HTMLCollection</code> interface represents a generic
- <span title="collections">collection</span> of elements.</p>
- <pre class="idl">interface <dfn>HTMLCollection</dfn> {
- readonly attribute unsigned long <span title="dom-HTMLCollection-length">length</span>;
- [IndexGetter] Element <span title="dom-HTMLCollection-item">item</span>(in unsigned long index);
- [NameGetter] Element <span title="dom-HTMLCollection-namedItem">namedItem</span>(in DOMString name);
-};</pre>
+ <dt><dfn title="url-host"><host></dfn></dt>
- <p>The <dfn
- title="dom-HTMLCollection-length"><code>length</code></dfn>
- attribute must return the number of nodes <span>represented by the
- collection</span>.</p>
+ <dd><p>The substring matched by the <host> production, if any.</p></dd>
- <p>The <dfn title="dom-HTMLCollection-item"><code>item(<var
- title="">index</var>)</code></dfn> method must return the <var
- title="">index</var>th node in the collection. If there is no <var
- title="">index</var>th node in the collection, then the method must
- return null.</p>
- <p>The <dfn
- title="dom-HTMLCollection-namedItem"><code>namedItem(<var
- title="">key</var>)</code></dfn> method must return the first node
- in the collection that matches the following requirements:</p>
+ <dt><dfn title="url-port"><port></dfn></dt>
- <ul>
+ <dd><p>The substring matched by the <port> production, if any.</p></dd>
- <li>It is an <code>a</code>, <code>applet</code>,
- <code>area</code>, <code>form</code>, <code>img</code>, or
- <code>object</code> element with a <code
- title="attr-name">name</code> attribute equal to <var
- title="">key</var>, or,</li>
- <li>It is an <span title="HTML elements">HTML element</span> of any
- kind with an <code title="attr-id">id</code> attribute equal to
- <var title="">key</var>. (Non-HTML elements, even if they have IDs,
- are not searched for the purposes of <code
- title="dom-HTMLCollection-namedItem">namedItem()</code>.)</li>
+ <dt><dfn title="url-hostport"><hostport></dfn></dt>
- </ul>
+ <dd><p>If there is a <scheme> component and a <port>
+ component and the port given by the <port> component is
+ different than the default port defined for the protocol given by
+ the <scheme> component, then <hostport> is the
+ substring that starts with the substring matched by the
+ <host> production and ends with the substring matched by the
+ <port> production, and includes the colon in between the
+ two. Otherwise, it is the same as the <host> component.</p>
- <p>If no such elements are found, then the method must return
- null.</p>
+ <dt><dfn title="url-path"><path></dfn></dt>
+ <dd>
- <h5>HTMLFormControlsCollection</h5>
+ <p>The substring matched by one of the following productions, if
+ one of them was matched:</p>
- <p>The <code>HTMLFormControlsCollection</code> interface represents
- a <span title="collections">collection</span> of form controls.</p>
+ <ul class="brief">
+ <li><path-abempty></li>
+ <li><path-absolute></li>
+ <li><path-noscheme></li>
+ <li><path-rootless></li>
+ <li><path-empty></li>
+ </ul>
- <pre class="idl">interface <dfn>HTMLFormControlsCollection</dfn> {
- readonly attribute unsigned long <span title="dom-HTMLFormControlsCollection-length">length</span>;
- [IndexGetter] <span>HTMLElement</span> <span title="dom-HTMLFormControlsCollection-item">item</span>(in unsigned long index);
- [NameGetter] Object <span title="dom-HTMLFormControlsCollection-namedItem">namedItem</span>(in DOMString name);
-};</pre>
+ </dd>
- <p>The <dfn
- title="dom-HTMLFormControlsCollection-length"><code>length</code></dfn>
- attribute must return the number of nodes <span>represented by the
- collection</span>.</p>
- <p>The <dfn
- title="dom-HTMLFormControlsCollection-item"><code>item(<var
- title="">index</var>)</code></dfn> method must return the <var
- title="">index</var>th node in the collection. If there is no <var
- title="">index</var>th node in the collection, then the method must
- return null.</p>
+ <dt><dfn title="url-query"><query></dfn></dt>
- <p>The <dfn
- title="dom-HTMLFormControlsCollection-namedItem"><code>namedItem(<var title="">key</var>)</code></dfn>
- method must act according to the following algorithm:
+ <dd><p>The substring matched by the <query> production, if any.</p></dd>
- <ol>
- <li>If, at the time the method is called, there is exactly one node
- in the collection that has either an <code
- title="attr-id">id</code> attribute or a <code
- title="attr-name">name</code> attribute equal to <var title="">key</var>,
- then return that node and stop the algorithm.</li>
+ <dt><dfn title="url-fragment"><fragment></dfn></dt>
- <li>Otherwise, if there are no nodes in the collection that have
- either an <code title="attr-id">id</code> attribute or a <code
- title="attr-name">name</code> attribute equal to <var
- title="">key</var>, then return null and stop the algorithm.</li>
+ <dd><p>The substring matched by the <fragment> production, if any.</p></dd>
- <li>Otherwise, create a <code>NodeList</code> object representing a
- live view of the <code>HTMLFormControlsCollection</code> object,
- further filtered so that the only nodes in the
- <code>NodeList</code> object are those that have either an <code
- title="attr-id">id</code> attribute or a <code
- title="attr-name">name</code> attribute equal to <var
- title="">key</var>. The nodes in the <code>NodeList</code> object
- must be sorted in <span>tree order</span>.</li>
+ </dl>
- <li>Return that <code>NodeList</code> object.</li>
+ </li>
</ol>
+ <!-- XXX we might want to define "server-based naming authority",
+ it's not clear RFC3986 does a good job of defining that anymore
+ (earlier URI specs did) -->
-<!--
-http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E...%0A%3Cform%20name%3D%22a%22%3E%3Cinput%20id%3D%22x%22%20name%3D%22y%22%3E%3Cinput%20name%3D%22x%22%20id%3D%22y%22%3E%3C/form%3E%0A%3Cscript%3E%0A%20%20var%20x%3B%0A%20%20w%28x%20%3D%20document.forms%5B%27a%27%5D%5B%27x%27%5D%29%3B%0A%20%20w%28x.length%29%3B%0A%20%20x%5B0%5D.parentNode.removeChild%28x%5B0%5D%29%3B%0A%20%20w%28x.length%29%3B%0A%20%20w%28x%20%3D%3D%20document.forms%5B%27a%27%5D%5B%27x%27%5D%29%3B%0A%3C/script%3E%0A
--->
+ <h4>Resolving URLs</h4>
- <h5>HTMLOptionsCollection</h5>
+ <p>Relative URLs are resolved relative to a base URL. The <dfn>base
+ URL</dfn> of a <span>URL</span> is the <span>absolute URL</span>
+ obtained as follows:</p>
- <p>The <code>HTMLOptionsCollection</code> interface represents
- a list of <code>option</code> elements.</p>
+ <dl class="switch">
- <pre class="idl">interface <dfn>HTMLOptionsCollection</dfn> {
- attribute unsigned long <span title="dom-HTMLOptionsCollection-length">length</span>;
- [IndexGetter] HTMLOptionElement <span title="dom-HTMLOptionsCollection-item">item</span>(in unsigned long index);
- [NameGetter] Object <span title="dom-HTMLOptionsCollection-namedItem">namedItem</span>(in DOMString name);
-};</pre>
+ <dt>If the URL to be resolved was passed to an API</dt>
- <p>On getting, the <dfn
- title="dom-HTMLOptionsCollection-length"><code>length</code></dfn>
- attribute must return the number of nodes <span>represented by the
- collection</span>.</p>
+ <dd><p>The base URL is the <span>document base URL</span> of the
+ script's <span>script document context</span>.</p></dd>
- <p>On setting, the behavior depends on whether the new value is
- equal to, greater than, or less than the number of nodes
- <span>represented by the collection</span> at that time. If the
- number is the same, then setting the attribute must do nothing. If
- the new value is greater, then <var title="">n</var> new
- <code>option</code> elements with no attributes and no child nodes
- must be appended to the <code>select</code> element on which the
- <code>HTMLOptionsCollection</code> is rooted, where <var
- title="">n</var> is the difference between the two numbers (new
- value minus old value). If the new value is lower, then the last
- <var title="">n</var> nodes in the collection must be removed from
- their parent nodes, where <var title="">n</var> is the difference
- between the two numbers (old value minus new value).</p>
+ <dt>If the URL to be resolved is from the value of a content
+ attribute</dt>
- <p class="note">Setting <code
- title="dom-HTMLOptionsCollection-length">length</code> never removes
- or adds any <code>optgroup</code> elements, and never adds new
- children to existing <code>optgroup</code> elements (though it can
- remove children from them).</p>
+ <dd>
- <p>The <dfn title="dom-HTMLOptionsCollection-item"><code>item(<var
- title="">index</var>)</code></dfn> method must return the <var
- title="">index</var>th node in the collection. If there is no <var
- title="">index</var>th node in the collection, then the method must
- return null.</p>
+ <p>The base URL is the <i>base URI of the element</i> that the
+ attribute is on, as defined by the XML Base specification, with
+ <i>the base URI of the document entity</i> being defined as the
+ <span>document base URL</span> of the <code>Document</code> that
+ owns the element.</p>
- <p>The <dfn
- title="dom-HTMLOptionsCollection-namedItem"><code>namedItem(<var title="">key</var>)</code></dfn>
- method must act according to the following algorithm:
+ <p>For the purposes of the XML Base specification, user agents
+ must act as if all <code>Document</code> objects represented XML
+ documents.</p>
+ <p class="note">It is possible for <code
+ title="attr-xml-base">xml:base</code> attributes to be present
+ even in HTML fragments, as such attributes can be added
+ dynamically using script. (Such scripts would not be conforming,
+ however, as <code title="attr-xml-base">xml:base</code> attributes
+ are not allowed in <span>HTML documents</span>.)</p>
+
+ </dd>
+
+ <dt>If the URL to be resolved was found in an offline application
+ cache manifest</dt>
+
+ <dd><p>The base URL is the URL of the <span>application
+ cache</span> <span
+ title="concept-appcache-manifest">manifest</span>.</p></dd>
+
+ </dl>
+
+ <p>The <dfn>document base URL</dfn> of a <code>Document</code> is
+ the <span>absolute URL</span> obtained by running these steps:</p>
+
<ol>
- <li>If, at the time the method is called, there is exactly one node
- in the collection that has either an <code
- title="attr-id">id</code> attribute or a <code
- title="attr-name">name</code> attribute equal to <var
- title="">key</var>, then return that node and stop the
- algorithm.</li>
+ <li><p>If there is no <code>base</code> element that is both a
+ child of <span>the <code>head</code> element</span> and has an
+ <code title="attr-base-href">href</code> attribute, then the
+ <span>document base URL</span> is <span>the document's
+ address</span><!-- XXXDOCURL -->.</p></li>
- <li>Otherwise, if there are no nodes in the collection that have
- either an <code title="attr-id">id</code> attribute or a <code
- title="attr-name">name</code> attribute equal to <var
- title="">key</var>, then return null and stop the algorithm.</li>
+ <li><p>Otherwise, let <var title="">url</var> be the value of the
+ <code title="attr-base-href">href</code> attribute of the first such
+ element.</p></li>
- <li>Otherwise, create a <code>NodeList</code> object representing a
- live view of the <code>HTMLOptionsCollection</code> object, further
- filtered so that the only nodes in the <code>NodeList</code> object
- are those that have either an <code title="attr-id">id</code>
- attribute or a <code title="attr-option-name">name</code> attribute
- equal to <var title="">key</var>. The nodes in the
- <code>NodeList</code> object must be sorted in <span>tree
- order</span>.</li>
+ <li><p><span title="resolve a URL">Resolve</span> the <var
+ title="">url</var> URL, using <span>the document's
+ address</span><!-- XXXDOCURL --> as the <span>base URL</span>
+ (thus, the <code>base</code> <code
+ title="attr-base-href">href</code> attribute isn't affect by <code
+ title="attr-xml-base">xml:base</code> attributes).</p></li>
- <li>Return that <code>NodeList</code> object.</li>
+ <li><p>The <span>document base URL</span> is the result of the
+ previous step if it was successful; otherwise it is <span>the
+ document's address</span><!-- XXXDOCURL -->.</p></li>
</ol>
- <!-- see also http://ln.hixie.ch/?start=1161042744&count=1 -->
+ <p>To <dfn>resolve a URL</dfn> to an <span>absolute URL</span> the
+ user agent must use the following steps. Resolving a URL can result
+ in an error, in which case the URL is not resolvable.</p>
- <p class="big-issue">We may want to add <code>add()</code> and
- <code>remove()</code> methods here too because IE implements
- HTMLSelectElement and HTMLOptionsCollection on the same object, and
- so people use them almost interchangeably in the wild.</p>
+ <ol>
+ <li><p>Let <var title="">url</var> be the <span>URL</span> being
+ resolved.</p></li>
- <h4>DOMTokenList</h4>
+ <li><p>Let <var title="">document</var> be the
+ <code>Document</code> <a href="#urldoc">associated with</a> <var
+ title="">url</var>.</p></li>
- <p>The <code>DOMTokenList</code> interface represents an interface
- to an underlying string that consists of an <span>unordered set of
- unique space-separated tokens</span>.</p>
+ <li><p>Let <var title="">encoding</var> be the <span
+ title="document's character encoding">character encoding</span> of
+ <var title="">document</var>.</p></li>
- <p>Which string underlies a particular <code>DOMTokenList</code>
- object is defined when the object is created. It might be a content
- attribute (e.g. the string that underlies the <code
- title="dom-classList">classList</code> object is the <code
- title="attr-class">class</code> attribute), or it might be an
- anonymous string (e.g. when a <code>DOMTokenList</code> object is
- passed to an author-implemented callback in the
- <code>datagrid</code> APIs).</p>
+ <li><p>If <var title="">encoding</var> is UTF-16, then change it to
+ UTF-8.</p></li>
- <pre class="idl">[<span title="dom-tokenlist-toString">Stringifies</span>] interface <dfn>DOMTokenList</dfn> {
- readonly attribute unsigned long <span title="dom-tokenlist-length">length</span>;
- [IndexGetter] DOMString <span title="dom-tokenlist-item">item</span>(in unsigned long index);
- boolean <span title="dom-tokenlist-has">has</span>(in DOMString token);
- void <span title="dom-tokenlist-add">add</span>(in DOMString token);
- void <span title="dom-tokenlist-remove">remove</span>(in DOMString token);
- boolean <span title="dom-tokenlist-toggle">toggle</span>(in DOMString token);
-};</pre>
+ <li><p>Let <var title="">base</var> be the <span>base URL</span>
+ for <var title="">url</var>. (This is an <span>absolute
+ URL</span>.)</p></li>
- <p>The <dfn title="dom-tokenlist-length"><code>length</code></dfn>
- attribute must return the number of <em>unique</em> tokens that
- result from <span title="split a string on spaces">splitting the
- underlying string on spaces</span>.</p>
+ <li><p><span title="parse a URL">Parse</span> <var
+ title="">url</var> into its component parts.</p></li>
- <p>The <dfn title="dom-tokenlist-item"><code>item(<var
- title="">index</var>)</code></dfn> method must <span title="split a
- string on spaces">split the underlying string on spaces</span>, sort
- the resulting list of tokens by Unicode codepoint<!-- XXX that's
- basically nonsense. What sort order do we want here? It should be
- the cheapest one possible that is well-defined for all Unicode. -->,
- remove exact duplicates, and then return the <var
- title="">index</var>th item in this list. If <var
- title="">index</var> is equal to or greater than the number of
- tokens, then the method must return null.</p>
+ <li>
+ <p>If parsing <var title="">url</var> resulted in a <span
+ title="url-host"><host></span> component, then replace the
+ matching subtring of <var title="">url</var> with the string that
+ results from expanding any sequences of percent-encoded octets in
+ that component that are valid UTF-8 sequences into Unicode
+ characters as defined by UTF-8.</p>
- <p>The <dfn title="dom-tokenlist-has"><code>has(<var
- title="">token</var>)</code></dfn> method must run the following
- algorithm:</p>
+ <p>If any percent-encoded octets in that component are not valid
+ UTF-8 sequences, then return an error and abort these steps.</p>
- <ol>
+ <p>Apply the IDNA ToASCII algorithm to the matching substring,
+ with both the AllowUnassigned and UseSTD3ASCIIRules flags
+ set. Replace the matching substring with the result of the ToASCII
+ algorithm.</p>
- <li>If the <var title="">token</var> argument contains any <span
- title="space character">space characters</span>, then raise an
- <code>INVALID_CHARACTER_ERR</code> exception and stop the
- algorithm.</li>
+ <p>If ToASCII fails to convert one of the components of the
+ string, e.g. because it is too long or because it contains invalid
+ characters, then return an error and abort these steps. <a
+ href="#refsRFC3490">[RFC3490]</a></p>
- <li>Otherwise, <span title="split a string on spaces">split the
- underlying string on spaces</span> to get the list of tokens in the
- object's underlying string.</li>
+ </li>
- <li>If the token indicated by <var title="">token</var> is one of
- the tokens in the object's underlying string then return true and
- stop this algorithm.</li>
+ <li>
- <li>Otherwise, return false.</li>
+ <p>If parsing <var title="">url</var> resulted in a <span
+ title="url-path"><path></span> component, then replace the
+ matching substring of <var title="">url</var> with the string that
+ results from applying the following steps to each character other
+ than U+0025 PERCENT SIGN (%) that doesn't match the original
+ <path> production defined in RFC 3986:</p>
- </ol>
+ <ol>
- <p>The <dfn title="dom-tokenlist-add"><code>add(<var
- title="">token</var>)</code></dfn> method must run the following
- algorithm:</p>
+ <li>Encode the character into a sequence of octets as defined by
+ UTF-8.</li>
- <ol>
+ <li>Replace the character with the percent-encoded form of those
+ octets. <a href="#refsRFC3986">[RFC3986]</a></li>
- <li>If the <var title="">token</var> argument contains any <span
- title="space character">space characters</span>, then raise an
- <code>INVALID_CHARACTER_ERR</code> exception and stop the
- algorithm.</li>
+ </ol>
- <li>Otherwise, <span title="split a string on spaces">split the
- underlying string on spaces</span> to get the list of tokens in the
- object's underlying string.</li>
+ <div class="example">
- <li>If the given <var title="">token</var> is already one of the
- tokens in the <code>DOMTokenList</code> object's underlying string
- then stop the algorithm.</li>
+ <p>For instance if <var title="">url</var> was "<code
+ title="">//example.com/a^b☺c%FFd%z/?e</code>", then the
+ <span title="url-path"><path></span> component's substring
+ would be "<code title="">/a^b☺c%FFd%z/</code>" and the two
+ characters that would have to be escaped would be "<code
+ title="">^</code>" and "<code title="">☺</code>". The
+ result after this step was applied would therefore be that <var
+ title="">url</var> now had the value "<code
+ title="">//example.com/a%5Eb%E2%98%BAc%FFd%z/?e</code>".</p>
- <li>Otherwise, if the <code>DOMTokenList</code> object's underlying
- string is not the empty string and the last character of that
- string is not a <span>space character</span>, then append a U+0020
- SPACE character to the end of that string.</li>
+ </div>
- <li>Append the value of <var title="">token</var> to the end of the
- <code>DOMTokenList</code> object's underlying string.</li>
+ </li>
- </ol>
+ <li>
- <p>The <dfn title="dom-tokenlist-remove"><code>remove(<var
- title="">token</var>)</code></dfn> method must run the following
- algorithm:</p>
+ <p>If parsing <var title="">url</var> resulted in a <span
+ title="url-query"><query></span> component, then replace the
+ matching substring of <var title="">url</var> with the string that
+ results from applying the following steps to each character other
+ than U+0025 PERCENT SIGN (%) that doesn't match the original
+ <query> production defined in RFC 3986:</p>
- <ol>
+ <ol>
- <li>If the <var title="">token</var> argument contains any <span
- title="space character">space characters</span>, then raise an
- <code>INVALID_CHARACTER_ERR</code> exception and stop the
- algorithm.</li>
+ <li>If the character in question cannot be expressed in the
+ encoding <var title="">encoding</var>, then replace it with a
+ single 0x3F octet (an ASCII question mark) and skip the remaining
+ substeps for this character.</li>
- <li>Otherwise, <span title="remove a token from a string">remove
- the given <var title="">token</var> from the underlying
- string</span>.</li>
+ <li>Encode the character into a sequence of octets as defined by
+ the encoding <var title="">encoding</var>.</li>
- </ol>
+ <li>Replace the character with the percent-encoded form of those
+ octets. <a href="#refsRFC3986">[RFC3986]</a></li>
- <p>The <dfn title="dom-tokenlist-toggle"><code>toggle(<var
- title="">token</var>)</code></dfn> method must run the following
- algorithm:</p>
+ </ol>
- <ol>
+ </li>
- <li>If the <var title="">token</var> argument contains any <span
- title="space character">space characters</span>, then raise an
- <code>INVALID_CHARACTER_ERR</code> exception and stop the
- algorithm.</li>
+ <li><p>Apply the algorithm described in RFC 3986 section 5.2
+ Relative Resolution, using <var title="">url</var> as the
+ potentially relative URI reference (<var title="">R</var>), and
+ <var title="">base</var> as the base URI (<var
+ title="">Base</var>). <a href="#refsRFC3986">[RFC3986]</a></p></li>
- <li>Otherwise, <span title="split a string on spaces">split the
- underlying string on spaces</span> to get the list of tokens in the
- object's underlying string.</li>
+ <li>
- <li>If the given <var title="">token</var> is already one of the
- tokens in the <code>DOMTokenList</code> object's underlying string
- then <span title="remove a token from a string">remove the given
- <var title="">token</var> from the underlying string</span>, and
- stop the algorithm, returning false.</li>
+ <p>Apply any relevant conformance criteria of RFC 3986 and RFC
+ 3987, returning an error and aborting these steps if
+ appropriate. <a href="#refsRFC3986">[RFC3986]</a> <a
+ href="#refsRFC3987">[RFC3987]</a></p>
- <li>Otherwise, if the <code>DOMTokenList</code> object's underlying
- string is not the empty string and the last character of that
- string is not a <span>space character</span>, then append a U+0020
- SPACE character to the end of that string.</li>
+ <p class="example">For instance, if an absolute URI that would be
+ returned by the above algorithm violates the restrictions specific
+ to its scheme, e.g. a <code title="">data:</code> URI using the
+ "<code title="">//</code>" server-based naming authority syntax,
+ then user agents are to treat this as an error instead.<!-- RFC
+ 3986, 3.1 Scheme --></p>
- <li>Append the value of <var title="">token</var> to the end of the
- <code>DOMTokenList</code> object's underlying string.</li>
+ </li>
- <li>Return true.</li>
+ <li><p>Let <var title="">result</var> be the target URI (<var
+ title="">T</var>) returned by the Relative Resolution
+ algorithm.</p></li>
+ <li><p>If <var title="">result</var> uses a scheme with a
+ server-based naming authority, replace all U+005C REVERSE SOLIDUS
+ (\) characters in <var title="">result</var> with U+002F SOLIDUS
+ (/) characters.</p></li>
+
+ <li><p>Return <var title="">result</var>.</p></li>
+
</ol>
- <p>Objects implementing the <code>DOMTokenList</code> interface must
- <dfn title="dom-tokenlist-toString">stringify</dfn> to the object's
- underlying string representation.</p>
+ <p>A <span>URL</span> is an <dfn>absolute URL</dfn> if <span
+ title="resolve a URL">resolving</span> it results in the same
+ URL without an error.</p>
- <h4>DOMStringMap</h4>
+ <h4>Dynamic changes to base URLs</h4>
- <p>The <code>DOMStringMap</code> interface represents a set of
- name-value pairs. When a <code>DOMStringMap</code> object is
- instanced, it is associated with three algorithms, one for getting
- values from names, one for setting names to certain values, and one
- for deleting names.</p>
+ <p>When an <code title="attr-xml-base">xml:base</code> attribute
+ changes, the attribute's element, and all descendant elements, are
+ <span>affected by a base URL change</span>.</p>
- <p class="big-issue">The names of the methods on this interface are
- temporary and will be fixed when the Web IDL / "Language Bindings
- for DOM Specifications" spec is ready to handle this case.</p>
+ <p>When a document's <span>document base URL</span> changes, all
+ elements in that document are <span>affected by a base URL
+ change</span>.</p>
- <pre class="idl">interface <dfn>DOMStringMap</dfn> {
- [NameGetter] DOMString <span title="dom-stringmap-XXX1">XXX1</span>(in DOMString name); <!-- XXX DOMB -->
- [NameSetter] void <span title="dom-stringmap-XXX2">XXX2</span>(in DOMString name, in DOMString value); <!-- XXX DOMB -->
- [XXX] boolean <span title="dom-stringmap-XXX3">XXX3</span>(in DOMString name); <!-- XXX DOMB -->
-};</pre>
+ <p>When an element is moved from one document to another, if the two
+ documents have different <span title="document base URL">base
+ URLs</span>, then that element and all its descendants are
+ <span>affected by a base URL change</span>.</p>
- <p>The <dfn title="dom-stringmap-XXX1"><code>XXX1(<var
- title="">name</var>)</code></dfn> method must call the algorithm for
- getting values from names, passing <var title="">name</var> as the
- name, and must return the corresponding value, or null if <var
- title="">name</var> has no corresponding value.</p>
+ <p>When an element is <dfn>affected by a base URL change</dfn>, it
+ must act as described in the following list:</p>
- <p>The <dfn title="dom-stringmap-XXX2"><code>XXX2(<var
- title="">name</var>, <var title="">value</var>)</code></dfn> method
- must call the algorithm for setting names to certain values, passing
- <var title="">name</var> as the name and <var title="">value</var>
- as the value.</p>
+ <dl class="switch">
- <p>The <dfn title="dom-stringmap-XXX3"><code>XXX3(<var
- title="">name</var>)</code></dfn> method must call the algorithm for
- deleting names, passing <var title="">name</var> as the name, and
- must return true.</p>
+ <dt>If the element is a <span title="hyperlink">hyperlink
+ element</span></dt>
+ <dd>
- <h4>DOM feature strings</h4>
+ <p>If the <span>absolute URL</span> identified by the hyperlink is
+ being shown to the user, or if any data derived from that URL is
+ affecting the display, then the <code
+ title="attr-hyperlink-href">href</code> attribute should be <span
+ title="resolve a url">reresolved</span> and the UI updated
+ appropriately.</p>
- <p>DOM3 Core defines mechanisms for checking for interface support,
- and for obtaining implementations of interfaces, using <a
- href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMFeatures">feature
- strings</a>. <a href="#refsDOM3CORE">[DOM3CORE]</a></p>
+ <p class="example">For example, the CSS <code
+ title="">:link</code>/<code title="">:visited</code>
+ pseudo-classes might have been affected.</p>
- <p>A DOM application can use the <dfn
- title="hasFeature"><code>hasFeature(<var title="">feature</var>,
- <var title="">version</var>)</code></dfn> method of the
- <code>DOMImplementation</code> interface with parameter values
- "<code title="">HTML</code>" and "<code>5.0</code>" (respectively)
- to determine whether or not this module is supported by the
- implementation. In addition to the feature string "<code
- title="">HTML</code>", the feature string "<code
- title="">XHTML</code>" (with version string "<code>5.0</code>") can
- be used to check if the implementation supports XHTML. User agents
- should respond with a true value when the <code>hasFeature</code>
- method is queried with these values. Authors are cautioned, however,
- that UAs returning true might not be perfectly compliant, and that
- UAs returning false might well have support for features in this
- specification; in general, therefore, use of this method is
- discouraged.</p>
+ <p>If the hyperlink has a <code
+ title="attr-hyperlink-ping">ping</code> attribute and its <span
+ title="absolute URL">absolute URL(s)</span> are being shown to the
+ user, then the <code title="attr-hyperlink-ping">ping</code>
+ attribute's tokens should be <span title="resolve a
+ url">reresolved</span> and the UI updated appropriately.</p>
- <p>The values "<code title="">HTML</code>" and "<code
- title="">XHTML</code>" (both with version "<code>5.0</code>") should
- also be supported in the context of the <code>getFeature()</code>
- and <code>isSupported()</code> methods, as defined by DOM3 Core.</p>
+ </dd>
- <p class="note">The interfaces defined in this specification are not
- always supersets of the interfaces defined in DOM2 HTML; some
- features that were formerly deprecated, poorly supported, rarely
- used or considered unnecessary have been removed. Therefore it is
- not guaranteed that an implementation that supports "<code
- title="">HTML</code>" "<code>5.0</code>" also supports "<code
- title="">HTML</code>" "<code>2.0</code>".</p>
+ <dt>If the element is a <code>blockquote</code>, <code>q</code>,
+ <code>ins</code>, or <code>del</code> element with a <code
+ title="">cite</code> attribute</dt>
+ <dd>
+ <p>If the <span>absolute URL</span> identified by the <code
+ title="">cite</code> attribute is being shown to the user, or if
+ any data derived from that URL is affecting the display, then the
+ it should be <span title="resolve a url">reresolved</span> and the
+ UI updated appropriately.</p>
+ </dd>
+
+ <dt>Otherwise</dt>
+
+ <dd>
+
+ <p>The element is not directly affected.</p>
+
+ <p class="example">Changing the base URL doesn't affect the image
+ displayed by <code>img</code> elements, although subsequent
+ accesses of the <code title="dom-img-src">src</code> DOM attribute
+ from script will return a new <span>absolute URL</span> that might
+ no longer correspond to the image being shown.</p>
+
+ </dd>
+
+ </dl>
+
+
+
+
+
+ <h4>Interfaces for URL manipulation</h4>
+
+ <p>An interface that has a complement of <dfn>URL decomposition
+ attributes</dfn> will have seven attributes with the following
+ definitions:</p>
+
+<pre class="idl">
+ attribute DOMString <span title="dom-uda-protocol">protocol</span>;
+ attribute DOMString <span title="dom-uda-host">host</span>;
+ attribute DOMString <span title="dom-uda-hostname">hostname</span>;
+ attribute DOMString <span title="dom-uda-port">port</span>;
+ attribute DOMString <span title="dom-uda-pathname">pathname</span>;
+ attribute DOMString <span title="dom-uda-search">search</span>;
+ attribute DOMString <span title="dom-uda-hash">hash</span>;
+</pre>
+
+ <p>The attributes defined to be URL decomposition attributes must
+ act as described for the attributes with the same corresponding
+ names in this section.</p>
+
+ <p>In addition, an interface with a complement of URL decomposition
+ attributes will define an <dfn
+ title="concept-uda-input">input</dfn>, which is a <span>URL</span>
+ that the attributes act on, and a <dfn
+ title="concept-uda-setter">common setter action</dfn>, which is a
+ set of steps invoked when any of the attributes' setters are
+ invoked.</p>
+
+ <p>The seven URL decomposition attributes have similar
+ requirements.</p>
+
+ <p>On getting, if the <span title="concept-uda-input">input</span>
+ fulfills the condition given in the "getter condition" column
+ corresponding to the attribute in the table below, the user agent
+ must return the part of the <span
+ title="concept-uda-input">input</span> URL given in the "component"
+ column, with any prefixes specified in the "prefix" column
+ appropriately added to the start of the string and any suffixes
+ specified in the "suffix" column appropriately added to the end of
+ the string. Otherwise, the attribute must return the empty
+ string.</p>
+
+ <p>On setting, the new value must first be mutated as described by
+ the "setter preprocessor" column, then mutated by %-escaping any
+ characters in the new value that are not valid in the relevant
+ component as given by the "component" column. Then, if the resulting
+ new value fulfills the condition given in the "setter condition"
+ column, the user agent must make a new string <var
+ title="">output</var> by replacing the component of the URL given by
+ the "component" column in the <span
+ title="concept-uda-input">input</span> URL with the new value;
+ otherwise, the user agent must let <var title="">output</var> be
+ equal to the <span title="concept-uda-input">input</span>. Finally,
+ the user agent must invoke the <span
+ title="concept-uda-setter">common setter action</span> with the
+ value of <var title="">output</var>.</p>
+
+ <p>When replacing a component in the URL, if the component is part
+ of an optional group in the URL syntax consisting of a character
+ followed by the component, the component (including its prefix
+ character) must be included even if the new value is the empty
+ string.</p>
+
+ <p class="note">The previous paragraph applies in particular to the
+ "<code title="">:</code>" before a <port> component, the "<code
+ title="">?</code>" before a <query> component, and the "<code
+ title="">#</code>" before a <fragment> component.</p>
+
+ <p>For the purposes of the above definitions, URLs must be parsed
+ using the <span title="parse a URL">URL parsing rules</span> defined
+ in this specification.</p>
+
+ <table>
+ <thead>
+ <tr>
+ <th>Attribute
+ <th>Component
+ <th>Getter Condition
+ <th>Prefix
+ <th>Suffix
+ <th>Setter Preprocessor
+ <th>Setter Condition
+ <tbody>
+ <tr>
+ <td><dfn title="dom-uda-protocol"><code>protocol</code></dfn>
+ <td><span title="url-scheme"><scheme></span>
+ <td>—
+ <td>—
+ <td>U+003A COLON ("<code title="">:</code>")
+ <td>Remove all trailing U+003A COLON ("<code title="">:</code>") characters
+ <td>The new value is not the empty string
+ <tr>
+ <td><dfn title="dom-uda-host"><code>host</code></dfn>
+ <td><span title="url-hostport"><hostport></span>
+ <td><span title="concept-uda-input">input</span> is hierarchical and uses a server-based naming authority
+ <td>—
+ <td>—
+ <td>—
+ <td>—
+ <tr>
+ <td><dfn title="dom-uda-hostname"><code>hostname</code></dfn>
+ <td><span title="url-host"><host></span>
+ <td><span title="concept-uda-input">input</span> is hierarchical and uses a server-based naming authority
+ <td>—
+ <td>—
+ <td>Remove all leading U+002F SOLIDUS ("<code title="">/</code>") characters
+ <td>—
+ <tr>
+ <td><dfn title="dom-uda-port"><code>port</code></dfn>
+ <td><span title="url-port"><port></span>
+ <td><span title="concept-uda-input">input</span> is hierarchical, uses a server-based naming authority, and contained a <span title="url-port"><port></span> component (possibly an empty one)
+ <td>—
+ <td>—
+ <td>Remove any characters in the new value that are not in the range U+0030 DIGIT ZERO .. U+0039 DIGIT NINE.
+ If the resulting string is empty, set it to a single U+0030 DIGIT ZERO character ('0').
+ <td>—
+ <tr>
+ <td><dfn title="dom-uda-pathname"><code>pathname</code></dfn>
+ <td><span title="url-path"><path></span>
+ <td><span title="concept-uda-input">input</span> is hierarchical
+ <td>—
+ <td>—
+ <td>If it has no leading U+002F SOLIDUS ("<code title="">/</code>") character, prepend a U+002F SOLIDUS ("<code title="">/</code>") character to the new value
+ <td>—
+ <tr>
+ <td><dfn title="dom-uda-search"><code>search</code></dfn>
+ <td><span title="url-query"><query></span>
+ <td><span title="concept-uda-input">input</span> is hierarchical, and contained a <span title="url-query"><query></span> component (possibly an empty one)
+ <td>U+003F QUESTION MARK ("<code title="">?</code>")
+ <td>—
+ <td>Remove one leading U+003F QUESTION MARK ("<code title="">?</code>") character, if any
+ <td>—
+ <tr>
+ <td><dfn title="dom-uda-hash"><code>hash</code></dfn>
+ <td><span title="url-fragment"><fragment></span>
+ <td><span title="concept-uda-input">input</span> contained a <span title="url-fragment"><fragment></span> component (possibly an empty one)
+ <td>U+0023 NUMBER SIGN ("<code title="">#</code>")
+ <td>—
+ <td>Remove one leading U+0023 NUMBER SIGN ("<code title="">#</code>") character, if any
+ <td>—
+ </table>
+
+<!--
+ http://www.hixie.ch/tests/adhoc/dom/level0/location/components/
+ http://lxr.mozilla.org/seamonkey/source/dom/src/base/nsLocation.cpp
+ http://wp.netscape.com/eng/mozilla/3.0/handbook/javascript/ref_h-l.htm#84722
+-->
+
+ <div class="example">
+
+ <p>The table below demonstrates how the getter condition for <code
+ title="dom-uda-search">search</code> results in different results
+ depending on the exact original syntax of the URL:</p>
+
+ <table>
+ <thead>
+ <tr>
+ <th> Input URL
+ <th> <code title="dom-uda-search">search</code> value
+ <th> Explanation
+ <tbody>
+ <tr>
+ <td> <code title="">http://example.com/</code>
+ <td> <i>empty string</i>
+ <td> No <span title="url-query"><query></span> component in input URL.
+ <tr>
+ <td> <code title="">http://example.com/?</code>
+ <td> <code title="">?</code>
+ <td> There is a <span title="url-query"><query></span> component, but it is empty. The question mark in the resulting value is the prefix.
+ <tr>
+ <td> <code title="">http://example.com/?test</code>
+ <td> <code title="">?test</code>
+ <td> The <span title="url-query"><query></span> component has the value "<code title="">test</code>".
+ <tr>
+ <td> <code title="">http://example.com/?test#</code>
+ <td> <code title="">?test</code>
+ <td> The (empty) <span title="url-fragment"><fragment></span> component is not part of the <span title="url-query"><query></span> component.
+ </table>
+
+ </div>
+
+
+
<h3>Fetching resources</h3>
<p class="big-issue">replace all instances of the word 'fetch' or
@@ -4843,9 +4227,625 @@
+ <h3>Common DOM interfaces</h3>
+ <h4>Reflecting content attributes in DOM attributes</h4>
+ <p>Some <span title="DOM attribute">DOM attributes</span> are
+ defined to <dfn>reflect</dfn> a particular <span>content
+ attribute</span>. This means that on getting, the DOM attribute
+ returns the current value of the content attribute, and on setting,
+ the DOM attribute changes the value of the content attribute to the
+ given value.</p>
+ <p>If a reflecting DOM attribute is a <code>DOMString</code>
+ attribute whose content attribute is defined to contain a
+ <span>URL</span>, then on getting, the DOM attribute must <span
+ title="resolve a url">resolve</span> the value of the content
+ attribute and return the resulting <span>absolute URL</span> if that
+ was successful, or the empty string otherwise; and on setting, must
+ set the content attribute to the specified literal value. If the
+ content attribute is absent, the DOM attribute must return the
+ default value, if the content attribute has one, or else the empty
+ string.</p>
+
+ <p>If a reflecting DOM attribute is a <code>DOMString</code>
+ attribute whose content attribute is defined to contain one or more
+ <span title="URL">URLs</span>, then on getting, the DOM attribute
+ must <span title="split the string on spaces">split the content
+ attribute on spaces</span> and return the concatenation of <span
+ title="resolve a URL">resolving</span> each token URL to an
+ <span>absolute URL</span>, with a single U+0020 SPACE character
+ between each URL, ignoring any tokens that did not resolve
+ successfully. If the content attribute is absent, the DOM attribute
+ must return the default value, if the content attribute has one, or
+ else the empty string. On setting, the DOM attribute must set the
+ content attribute to the specified literal value.</p>
+
+ <p>If a reflecting DOM attribute is a <code>DOMString</code> whose
+ content attribute is an <span>enumerated attribute</span>, and the
+ DOM attribute is <dfn>limited to only known values</dfn>, then, on
+ getting, the DOM attribute must return the conforming value
+ associated with the state the attribute is in (in its canonical
+ case), or the empty string if the attribute is in a state that has
+ no associated keyword value; and on setting, if the new value is an
+ <span>ASCII case-insensitive</span> match for one of the keywords
+ given for that attribute, then the content attribute must be set to
+ the conforming value associated with the state that the attribute
+ would be in if set to the given new value, otherwise, if the new
+ value is the empty string, then the content attribute must be
+ removed, otherwise, the setter must raise a <code>SYNTAX_ERR</code>
+ exception.</p>
+
+ <p>If a reflecting DOM attribute is a <code>DOMString</code> but
+ doesn't fall into any of the above categories, then the getting and
+ setting must be done in a transparent, case-preserving manner.</p>
+
+ <p>If a reflecting DOM attribute is a boolean attribute, then on
+ getting the DOM attribute must return true if the attribute is set,
+ and false if it is absent. On setting, the content attribute must be
+ removed if the DOM attribute is set to false, and must be set to
+ have the same value as its name if the DOM attribute is set to
+ true. (This corresponds to the rules for <span title="boolean
+ attribute">boolean content attributes</span>.)</p>
+
+ <p>If a reflecting DOM attribute is a signed integer type
+ (<code>long</code>) then, on getting, the content attribute must be
+ parsed according to <span title="rules for parsing integers">the
+ rules for parsing signed integers</span>, and if that is successful,
+ the resulting value must be returned. If, on the other hand, it
+ fails, or if the attribute is absent, then the default value must be
+ returned instead, or 0 if there is no default value. On setting, the
+ given value must be converted to the shortest possible string
+ representing the number as a <span>valid integer</span> in base ten
+ and then that string must be used as the new content attribute
+ value.</p>
+
+ <p>If a reflecting DOM attribute is an <em>unsigned</em> integer
+ type (<code>unsigned long</code>) then, on getting, the content
+ attribute must be parsed according to <span title="rules for parsing
+ non-negative integers">the rules for parsing unsigned
+ integers</span>, and if that is successful, the resulting value must
+ be returned. If, on the other hand, it fails, or if the attribute is
+ absent, the default value must be returned instead, or 0 if there is
+ no default value. On setting, the given value must be converted to
+ the shortest possible string representing the number as a
+ <span>valid non-negative integer</span> in base ten and then that
+ string must be used as the new content attribute value.</p>
+
+ <p>If a reflecting DOM attribute is an unsigned integer type
+ (<code>unsigned long</code>) that is <dfn>limited to only positive
+ non-zero numbers</dfn>, then the behavior is similar to the previous
+ case, but zero is not allowed. On getting, the content attribute
+ must first be parsed according to <span title="rules for parsing
+ non-negative integers">the rules for parsing unsigned
+ integers</span>, and if that is successful, the resulting value must
+ be returned. If, on the other hand, it fails, or if the attribute is
+ absent, the default value must be returned instead, or 1 if there is
+ no default value. On setting, if the value is zero, the user agent
+ must fire an <code>INDEX_SIZE_ERR</code> exception. Otherwise, the
+ given value must be converted to the shortest possible string
+ representing the number as a <span>valid non-negative integer</span>
+ in base ten and then that string must be used as the new content
+ attribute value.</p>
+
+ <p>If a reflecting DOM attribute is a floating point number type
+ (<code>float</code>) and the content attribute is defined to contain
+ a time offset, then, on getting, the content attribute must be
+ parsed according to <span title="rules for parsing time offsets">the
+ rules for parsing time offsets</span>, and if that is successful, the
+ resulting value, in seconds, must be returned. If that fails, or if
+ the attribute is absent, the default value must be returned, or the
+ not-a-number value (NaN) if there is no default value. On setting,
+ the given value, interpreted as a time offset in seconds, must be
+ converted to a string using the <span>time offset serialization
+ rules</span>, and that string must be used as the new content
+ attribute value.</p>
+
+ <p>If a reflecting DOM attribute is a floating point number type
+ (<code>float</code>) and it doesn't fall into one of the earlier
+ categories, then, on getting, the content attribute must be parsed
+ according to <span title="rules for parsing floating point number
+ values">the rules for parsing floating point number values</span>,
+ and if that is successful, the resulting value must be returned. If,
+ on the other hand, it fails, or if the attribute is absent, the
+ default value must be returned instead, or 0.0 if there is no
+ default value. On setting, the given value must be converted to the
+ shortest possible string representing the number as a <span>valid
+ floating point number</span> in base ten and then that string must
+ be used as the new content attribute value.</p>
+
+ <p>If a reflecting DOM attribute is of the type
+ <code>DOMTokenList</code>, then on getting it must return a
+ <code>DOMTokenList</code> object whose underlying string is the
+ element's corresponding content attribute. When the
+ <code>DOMTokenList</code> object mutates its underlying string, the
+ content attribute must itself be immediately mutated. When the
+ attribute is absent, then the string represented by the
+ <code>DOMTokenList</code> object is the empty string; when the
+ object mutates this empty string, the user agent must first add the
+ corresponding content attribute, and then mutate that attribute
+ instead. <code>DOMTokenList</code> attributes are always
+ read-only. The same <code>DOMTokenList</code> object must be
+ returned every time for each attribute.</p>
+
+ <p>If a reflecting DOM attribute has the type
+ <code>HTMLElement</code>, or an interface that descends from
+ <code>HTMLElement</code>, then, on getting, it must run the
+ following algorithm (stopping at the first point where a value is
+ returned):
+
+ <ol>
+
+ <li>If the corresponding content attribute is absent, then the
+ DOM attribute must return null.</li>
+
+ <li>Let <var title="">candidate</var> be the element that the <code
+ title="">document.getElementById()</code> method would find if it
+ was passed as its argument the current value of the corresponding
+ content attribute.</li>
+
+ <li>If <var title="">candidate</var> is null, or if it is not
+ type-compatible with the DOM attribute, then the DOM attribute must
+ return null.</li>
+
+ <li>Otherwise, it must return <var title="">candidate</var>.</li>
+
+ </ol>
+
+ <p>On setting, if the given element has an <code
+ title="attr-id">id</code> attribute, then the content attribute must
+ be set to the value of that <code title="attr-id">id</code>
+ attribute. Otherwise, the DOM attribute must be set to the empty
+ string.</p><!-- XXX or raise an exception? -->
+
+
+
+ <h4>Collections</h4>
+
+ <p>The <code>HTMLCollection</code>,
+ <code>HTMLFormControlsCollection</code>, and
+ <code>HTMLOptionsCollection</code> interfaces represent various
+ lists of DOM nodes. Collectively, objects implementing these
+ interfaces are called <dfn>collections</dfn>.</p>
+
+ <p>When a <span title="collections">collection</span> is created, a
+ filter and a root are associated with the collection.</p>
+
+ <p class="example">For example, when the <code>HTMLCollection</code>
+ object for the <code
+ title="dom-document-images">document.images</code> attribute is
+ created, it is associated with a filter that selects only
+ <code>img</code> elements, and rooted at the root of the
+ document.</p>
+
+ <p>The <span title="collections">collection</span> then <dfn
+ title="represented by the collection">represents</dfn> a
+ <span>live</span> view of the subtree rooted at the collection's
+ root, containing only nodes that match the given filter. The view is
+ linear. In the absence of specific requirements to the contrary, the
+ nodes within the collection must be sorted in <span>tree
+ order</span>.</p>
+
+ <p class="note">The <code title="dom-table-rows">rows</code> list is
+ not in tree order.</p>
+
+ <p>An attribute that returns a collection must return the same
+ object every time it is retrieved.</p>
+
+
+ <h5>HTMLCollection</h5>
+
+ <p>The <code>HTMLCollection</code> interface represents a generic
+ <span title="collections">collection</span> of elements.</p>
+
+ <pre class="idl">interface <dfn>HTMLCollection</dfn> {
+ readonly attribute unsigned long <span title="dom-HTMLCollection-length">length</span>;
+ [IndexGetter] Element <span title="dom-HTMLCollection-item">item</span>(in unsigned long index);
+ [NameGetter] Element <span title="dom-HTMLCollection-namedItem">namedItem</span>(in DOMString name);
+};</pre>
+
+ <p>The <dfn
+ title="dom-HTMLCollection-length"><code>length</code></dfn>
+ attribute must return the number of nodes <span>represented by the
+ collection</span>.</p>
+
+ <p>The <dfn title="dom-HTMLCollection-item"><code>item(<var
+ title="">index</var>)</code></dfn> method must return the <var
+ title="">index</var>th node in the collection. If there is no <var
+ title="">index</var>th node in the collection, then the method must
+ return null.</p>
+
+ <p>The <dfn
+ title="dom-HTMLCollection-namedItem"><code>namedItem(<var
+ title="">key</var>)</code></dfn> method must return the first node
+ in the collection that matches the following requirements:</p>
+
+ <ul>
+
+ <li>It is an <code>a</code>, <code>applet</code>,
+ <code>area</code>, <code>form</code>, <code>img</code>, or
+ <code>object</code> element with a <code
+ title="attr-name">name</code> attribute equal to <var
+ title="">key</var>, or,</li>
+
+ <li>It is an <span title="HTML elements">HTML element</span> of any
+ kind with an <code title="attr-id">id</code> attribute equal to
+ <var title="">key</var>. (Non-HTML elements, even if they have IDs,
+ are not searched for the purposes of <code
+ title="dom-HTMLCollection-namedItem">namedItem()</code>.)</li>
+
+ </ul>
+
+ <p>If no such elements are found, then the method must return
+ null.</p>
+
+
+
+ <h5>HTMLFormControlsCollection</h5>
+
+ <p>The <code>HTMLFormControlsCollection</code> interface represents
+ a <span title="collections">collection</span> of form controls.</p>
+
+ <pre class="idl">interface <dfn>HTMLFormControlsCollection</dfn> {
+ readonly attribute unsigned long <span title="dom-HTMLFormControlsCollection-length">length</span>;
+ [IndexGetter] <span>HTMLElement</span> <span title="dom-HTMLFormControlsCollection-item">item</span>(in unsigned long index);
+ [NameGetter] Object <span title="dom-HTMLFormControlsCollection-namedItem">namedItem</span>(in DOMString name);
+};</pre>
+
+ <p>The <dfn
+ title="dom-HTMLFormControlsCollection-length"><code>length</code></dfn>
+ attribute must return the number of nodes <span>represented by the
+ collection</span>.</p>
+
+ <p>The <dfn
+ title="dom-HTMLFormControlsCollection-item"><code>item(<var
+ title="">index</var>)</code></dfn> method must return the <var
+ title="">index</var>th node in the collection. If there is no <var
+ title="">index</var>th node in the collection, then the method must
+ return null.</p>
+
+ <p>The <dfn
+ title="dom-HTMLFormControlsCollection-namedItem"><code>namedItem(<var title="">key</var>)</code></dfn>
+ method must act according to the following algorithm:
+
+ <ol>
+
+ <li>If, at the time the method is called, there is exactly one node
+ in the collection that has either an <code
+ title="attr-id">id</code> attribute or a <code
+ title="attr-name">name</code> attribute equal to <var title="">key</var>,
+ then return that node and stop the algorithm.</li>
+
+ <li>Otherwise, if there are no nodes in the collection that have
+ either an <code title="attr-id">id</code> attribute or a <code
+ title="attr-name">name</code> attribute equal to <var
+ title="">key</var>, then return null and stop the algorithm.</li>
+
+ <li>Otherwise, create a <code>NodeList</code> object representing a
+ live view of the <code>HTMLFormControlsCollection</code> object,
+ further filtered so that the only nodes in the
+ <code>NodeList</code> object are those that have either an <code
+ title="attr-id">id</code> attribute or a <code
+ title="attr-name">name</code> attribute equal to <var
+ title="">key</var>. The nodes in the <code>NodeList</code> object
+ must be sorted in <span>tree order</span>.</li>
+
+ <li>Return that <code>NodeList</code> object.</li>
+
+ </ol>
+
+
+<!--
+http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E...%0A%3Cform%20name%3D%22a%22%3E%3Cinput%20id%3D%22x%22%20name%3D%22y%22%3E%3Cinput%20name%3D%22x%22%20id%3D%22y%22%3E%3C/form%3E%0A%3Cscript%3E%0A%20%20var%20x%3B%0A%20%20w%28x%20%3D%20document.forms%5B%27a%27%5D%5B%27x%27%5D%29%3B%0A%20%20w%28x.length%29%3B%0A%20%20x%5B0%5D.parentNode.removeChild%28x%5B0%5D%29%3B%0A%20%20w%28x.length%29%3B%0A%20%20w%28x%20%3D%3D%20document.forms%5B%27a%27%5D%5B%27x%27%5D%29%3B%0A%3C/script%3E%0A
+-->
+
+
+ <h5>HTMLOptionsCollection</h5>
+
+ <p>The <code>HTMLOptionsCollection</code> interface represents
+ a list of <code>option</code> elements.</p>
+
+ <pre class="idl">interface <dfn>HTMLOptionsCollection</dfn> {
+ attribute unsigned long <span title="dom-HTMLOptionsCollection-length">length</span>;
+ [IndexGetter] HTMLOptionElement <span title="dom-HTMLOptionsCollection-item">item</span>(in unsigned long index);
+ [NameGetter] Object <span title="dom-HTMLOptionsCollection-namedItem">namedItem</span>(in DOMString name);
+};</pre>
+
+ <p>On getting, the <dfn
+ title="dom-HTMLOptionsCollection-length"><code>length</code></dfn>
+ attribute must return the number of nodes <span>represented by the
+ collection</span>.</p>
+
+ <p>On setting, the behavior depends on whether the new value is
+ equal to, greater than, or less than the number of nodes
+ <span>represented by the collection</span> at that time. If the
+ number is the same, then setting the attribute must do nothing. If
+ the new value is greater, then <var title="">n</var> new
+ <code>option</code> elements with no attributes and no child nodes
+ must be appended to the <code>select</code> element on which the
+ <code>HTMLOptionsCollection</code> is rooted, where <var
+ title="">n</var> is the difference between the two numbers (new
+ value minus old value). If the new value is lower, then the last
+ <var title="">n</var> nodes in the collection must be removed from
+ their parent nodes, where <var title="">n</var> is the difference
+ between the two numbers (old value minus new value).</p>
+
+ <p class="note">Setting <code
+ title="dom-HTMLOptionsCollection-length">length</code> never removes
+ or adds any <code>optgroup</code> elements, and never adds new
+ children to existing <code>optgroup</code> elements (though it can
+ remove children from them).</p>
+
+ <p>The <dfn title="dom-HTMLOptionsCollection-item"><code>item(<var
+ title="">index</var>)</code></dfn> method must return the <var
+ title="">index</var>th node in the collection. If there is no <var
+ title="">index</var>th node in the collection, then the method must
+ return null.</p>
+
+ <p>The <dfn
+ title="dom-HTMLOptionsCollection-namedItem"><code>namedItem(<var title="">key</var>)</code></dfn>
+ method must act according to the following algorithm:
+
+ <ol>
+
+ <li>If, at the time the method is called, there is exactly one node
+ in the collection that has either an <code
+ title="attr-id">id</code> attribute or a <code
+ title="attr-name">name</code> attribute equal to <var
+ title="">key</var>, then return that node and stop the
+ algorithm.</li>
+
+ <li>Otherwise, if there are no nodes in the collection that have
+ either an <code title="attr-id">id</code> attribute or a <code
+ title="attr-name">name</code> attribute equal to <var
+ title="">key</var>, then return null and stop the algorithm.</li>
+
+ <li>Otherwise, create a <code>NodeList</code> object representing a
+ live view of the <code>HTMLOptionsCollection</code> object, further
+ filtered so that the only nodes in the <code>NodeList</code> object
+ are those that have either an <code title="attr-id">id</code>
+ attribute or a <code title="attr-option-name">name</code> attribute
+ equal to <var title="">key</var>. The nodes in the
+ <code>NodeList</code> object must be sorted in <span>tree
+ order</span>.</li>
+
+ <li>Return that <code>NodeList</code> object.</li>
+
+ </ol>
+
+ <!-- see also http://ln.hixie.ch/?start=1161042744&count=1 -->
+
+ <p class="big-issue">We may want to add <code>add()</code> and
+ <code>remove()</code> methods here too because IE implements
+ HTMLSelectElement and HTMLOptionsCollection on the same object, and
+ so people use them almost interchangeably in the wild.</p>
+
+
+ <h4>DOMTokenList</h4>
+
+ <p>The <code>DOMTokenList</code> interface represents an interface
+ to an underlying string that consists of an <span>unordered set of
+ unique space-separated tokens</span>.</p>
+
+ <p>Which string underlies a particular <code>DOMTokenList</code>
+ object is defined when the object is created. It might be a content
+ attribute (e.g. the string that underlies the <code
+ title="dom-classList">classList</code> object is the <code
+ title="attr-class">class</code> attribute), or it might be an
+ anonymous string (e.g. when a <code>DOMTokenList</code> object is
+ passed to an author-implemented callback in the
+ <code>datagrid</code> APIs).</p>
+
+ <pre class="idl">[<span title="dom-tokenlist-toString">Stringifies</span>] interface <dfn>DOMTokenList</dfn> {
+ readonly attribute unsigned long <span title="dom-tokenlist-length">length</span>;
+ [IndexGetter] DOMString <span title="dom-tokenlist-item">item</span>(in unsigned long index);
+ boolean <span title="dom-tokenlist-has">has</span>(in DOMString token);
+ void <span title="dom-tokenlist-add">add</span>(in DOMString token);
+ void <span title="dom-tokenlist-remove">remove</span>(in DOMString token);
+ boolean <span title="dom-tokenlist-toggle">toggle</span>(in DOMString token);
+};</pre>
+
+ <p>The <dfn title="dom-tokenlist-length"><code>length</code></dfn>
+ attribute must return the number of <em>unique</em> tokens that
+ result from <span title="split a string on spaces">splitting the
+ underlying string on spaces</span>.</p>
+
+ <p>The <dfn title="dom-tokenlist-item"><code>item(<var
+ title="">index</var>)</code></dfn> method must <span title="split a
+ string on spaces">split the underlying string on spaces</span>, sort
+ the resulting list of tokens by Unicode codepoint<!-- XXX that's
+ basically nonsense. What sort order do we want here? It should be
+ the cheapest one possible that is well-defined for all Unicode. -->,
+ remove exact duplicates, and then return the <var
+ title="">index</var>th item in this list. If <var
+ title="">index</var> is equal to or greater than the number of
+ tokens, then the method must return null.</p>
+
+
+ <p>The <dfn title="dom-tokenlist-has"><code>has(<var
+ title="">token</var>)</code></dfn> method must run the following
+ algorithm:</p>
+
+ <ol>
+
+ <li>If the <var title="">token</var> argument contains any <span
+ title="space character">space characters</span>, then raise an
+ <code>INVALID_CHARACTER_ERR</code> exception and stop the
+ algorithm.</li>
+
+ <li>Otherwise, <span title="split a string on spaces">split the
+ underlying string on spaces</span> to get the list of tokens in the
+ object's underlying string.</li>
+
+ <li>If the token indicated by <var title="">token</var> is one of
+ the tokens in the object's underlying string then return true and
+ stop this algorithm.</li>
+
+ <li>Otherwise, return false.</li>
+
+ </ol>
+
+ <p>The <dfn title="dom-tokenlist-add"><code>add(<var
+ title="">token</var>)</code></dfn> method must run the following
+ algorithm:</p>
+
+ <ol>
+
+ <li>If the <var title="">token</var> argument contains any <span
+ title="space character">space characters</span>, then raise an
+ <code>INVALID_CHARACTER_ERR</code> exception and stop the
+ algorithm.</li>
+
+ <li>Otherwise, <span title="split a string on spaces">split the
+ underlying string on spaces</span> to get the list of tokens in the
+ object's underlying string.</li>
+
+ <li>If the given <var title="">token</var> is already one of the
+ tokens in the <code>DOMTokenList</code> object's underlying string
+ then stop the algorithm.</li>
+
+ <li>Otherwise, if the <code>DOMTokenList</code> object's underlying
+ string is not the empty string and the last character of that
+ string is not a <span>space character</span>, then append a U+0020
+ SPACE character to the end of that string.</li>
+
+ <li>Append the value of <var title="">token</var> to the end of the
+ <code>DOMTokenList</code> object's underlying string.</li>
+
+ </ol>
+
+ <p>The <dfn title="dom-tokenlist-remove"><code>remove(<var
+ title="">token</var>)</code></dfn> method must run the following
+ algorithm:</p>
+
+ <ol>
+
+ <li>If the <var title="">token</var> argument contains any <span
+ title="space character">space characters</span>, then raise an
+ <code>INVALID_CHARACTER_ERR</code> exception and stop the
+ algorithm.</li>
+
+ <li>Otherwise, <span title="remove a token from a string">remove
+ the given <var title="">token</var> from the underlying
+ string</span>.</li>
+
+ </ol>
+
+ <p>The <dfn title="dom-tokenlist-toggle"><code>toggle(<var
+ title="">token</var>)</code></dfn> method must run the following
+ algorithm:</p>
+
+ <ol>
+
+ <li>If the <var title="">token</var> argument contains any <span
+ title="space character">space characters</span>, then raise an
+ <code>INVALID_CHARACTER_ERR</code> exception and stop the
+ algorithm.</li>
+
+ <li>Otherwise, <span title="split a string on spaces">split the
+ underlying string on spaces</span> to get the list of tokens in the
+ object's underlying string.</li>
+
+ <li>If the given <var title="">token</var> is already one of the
+ tokens in the <code>DOMTokenList</code> object's underlying string
+ then <span title="remove a token from a string">remove the given
+ <var title="">token</var> from the underlying string</span>, and
+ stop the algorithm, returning false.</li>
+
+ <li>Otherwise, if the <code>DOMTokenList</code> object's underlying
+ string is not the empty string and the last character of that
+ string is not a <span>space character</span>, then append a U+0020
+ SPACE character to the end of that string.</li>
+
+ <li>Append the value of <var title="">token</var> to the end of the
+ <code>DOMTokenList</code> object's underlying string.</li>
+
+ <li>Return true.</li>
+
+ </ol>
+
+ <p>Objects implementing the <code>DOMTokenList</code> interface must
+ <dfn title="dom-tokenlist-toString">stringify</dfn> to the object's
+ underlying string representation.</p>
+
+
+ <h4>DOMStringMap</h4>
+
+ <p>The <code>DOMStringMap</code> interface represents a set of
+ name-value pairs. When a <code>DOMStringMap</code> object is
+ instanced, it is associated with three algorithms, one for getting
+ values from names, one for setting names to certain values, and one
+ for deleting names.</p>
+
+ <p class="big-issue">The names of the methods on this interface are
+ temporary and will be fixed when the Web IDL / "Language Bindings
+ for DOM Specifications" spec is ready to handle this case.</p>
+
+ <pre class="idl">interface <dfn>DOMStringMap</dfn> {
+ [NameGetter] DOMString <span title="dom-stringmap-XXX1">XXX1</span>(in DOMString name); <!-- XXX DOMB -->
+ [NameSetter] void <span title="dom-stringmap-XXX2">XXX2</span>(in DOMString name, in DOMString value); <!-- XXX DOMB -->
+ [XXX] boolean <span title="dom-stringmap-XXX3">XXX3</span>(in DOMString name); <!-- XXX DOMB -->
+};</pre>
+
+ <p>The <dfn title="dom-stringmap-XXX1"><code>XXX1(<var
+ title="">name</var>)</code></dfn> method must call the algorithm for
+ getting values from names, passing <var title="">name</var> as the
+ name, and must return the corresponding value, or null if <var
+ title="">name</var> has no corresponding value.</p>
+
+ <p>The <dfn title="dom-stringmap-XXX2"><code>XXX2(<var
+ title="">name</var>, <var title="">value</var>)</code></dfn> method
+ must call the algorithm for setting names to certain values, passing
+ <var title="">name</var> as the name and <var title="">value</var>
+ as the value.</p>
+
+ <p>The <dfn title="dom-stringmap-XXX3"><code>XXX3(<var
+ title="">name</var>)</code></dfn> method must call the algorithm for
+ deleting names, passing <var title="">name</var> as the name, and
+ must return true.</p>
+
+
+ <h4>DOM feature strings</h4>
+
+ <p>DOM3 Core defines mechanisms for checking for interface support,
+ and for obtaining implementations of interfaces, using <a
+ href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMFeatures">feature
+ strings</a>. <a href="#refsDOM3CORE">[DOM3CORE]</a></p>
+
+ <p>A DOM application can use the <dfn
+ title="hasFeature"><code>hasFeature(<var title="">feature</var>,
+ <var title="">version</var>)</code></dfn> method of the
+ <code>DOMImplementation</code> interface with parameter values
+ "<code title="">HTML</code>" and "<code>5.0</code>" (respectively)
+ to determine whether or not this module is supported by the
+ implementation. In addition to the feature string "<code
+ title="">HTML</code>", the feature string "<code
+ title="">XHTML</code>" (with version string "<code>5.0</code>") can
+ be used to check if the implementation supports XHTML. User agents
+ should respond with a true value when the <code>hasFeature</code>
+ method is queried with these values. Authors are cautioned, however,
+ that UAs returning true might not be perfectly compliant, and that
+ UAs returning false might well have support for features in this
+ specification; in general, therefore, use of this method is
+ discouraged.</p>
+
+ <p>The values "<code title="">HTML</code>" and "<code
+ title="">XHTML</code>" (both with version "<code>5.0</code>") should
+ also be supported in the context of the <code>getFeature()</code>
+ and <code>isSupported()</code> methods, as defined by DOM3 Core.</p>
+
+ <p class="note">The interfaces defined in this specification are not
+ always supersets of the interfaces defined in DOM2 HTML; some
+ features that were formerly deprecated, poorly supported, rarely
+ used or considered unnecessary have been removed. Therefore it is
+ not guaranteed that an implementation that supports "<code
+ title="">HTML</code>" "<code>5.0</code>" also supports "<code
+ title="">HTML</code>" "<code>2.0</code>".</p>
+
+
+
+
<h2 id="dom">Semantics and structure of HTML documents</h2>
<h3 id="semantics-intro">Introduction</h3>
More information about the Commit-Watchers
mailing list