[html5] r3105 - [t] (0) Changed HTMLPropertyCollection to always return PropertyNodeLists when a [...]
whatwg at whatwg.org
whatwg at whatwg.org
Fri May 15 19:02:47 PDT 2009
Author: ianh
Date: 2009-05-15 19:02:46 -0700 (Fri, 15 May 2009)
New Revision: 3105
Modified:
index
source
Log:
[t] (0) Changed HTMLPropertyCollection to always return PropertyNodeLists when accessed by name. Make itemprop=about only work for RDF on the linking elements. vCard output support. Minor tweaks to microdata. Editorial fixes.
Modified: index
===================================================================
--- index 2009-05-15 00:36:49 UTC (rev 3104)
+++ index 2009-05-16 02:02:46 UTC (rev 3105)
@@ -39,7 +39,7 @@
<div class=head>
<p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
<h1>HTML 5</h1>
- <h2 class="no-num no-toc" id=draft-recommendation-—-date:-01-jan-1901>Draft Recommendation — 15 May 2009</h2>
+ <h2 class="no-num no-toc" id=draft-recommendation-—-date:-01-jan-1901>Draft Recommendation — 16 May 2009</h2>
<p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
<p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
<dl><dt>Multiple-page version:</dt>
@@ -2159,6 +2159,11 @@
<p>The <dfn id=white_space title=White_Space>White_Space characters</dfn> are
those that have the Unicode property "White_Space". <a href=#refsUNICODE>[UNICODE]</a></p>
+ <p>The <dfn id=alphanumeric-ascii-characters>alphanumeric ASCII characters</dfn> are those in the
+ ranges U+0030 DIGIT ZERO .. U+0039 DIGIT NINE, U+0041 LATIN CAPITAL
+ LETTER A .. U+005A LATIN CAPITAL LETTER Z, U+0061 LATIN SMALL LETTER
+ A .. U+007A LATIN SMALL LETTER Z.</p>
+
<p>Some of the micro-parsers described below follow the pattern of
having an <var title="">input</var> variable that holds the string
being parsed, and having a <var title="">position</var> variable
@@ -6479,15 +6484,16 @@
<pre class=idl>[Callable=<a href=#dom-htmlpropertycollection-nameditem title=dom-HTMLPropertyCollection-namedItem>namedItem</a>]
interface <dfn id=htmlpropertycollection-0>HTMLPropertyCollection</dfn> {
readonly attribute unsigned long <a href=#dom-htmlpropertycollection-length title=dom-HTMLPropertyCollection-length>length</a>;
+ [IndexGetter] <a href=#htmlelement>HTMLElement</a> <a href=#dom-htmlpropertycollection-item title=dom-HTMLPropertyCollection-item>item</a>(in unsigned long index);
+
readonly attribute <span>DOMStringList</span> <a href=#dom-htmlpropertycollection-names title=dom-HTMLPropertyCollection-names>names</a>;
- [IndexGetter] <a href=#htmlelement>HTMLElement</a> <a href=#dom-htmlpropertycollection-item title=dom-HTMLPropertyCollection-item>item</a>(in unsigned long index);
- [NameGetter] Object <a href=#dom-htmlpropertycollection-nameditem title=dom-HTMLPropertyCollection-namedItem>namedItem</a>(in DOMString name);
+ [NameGetter] <a href=#propertynodelist>PropertyNodeList</a> <a href=#dom-htmlpropertycollection-nameditem title=dom-HTMLPropertyCollection-namedItem>namedItem</a>(in DOMString name);
};
-typedef sequence<DOMString> <dfn id=domstringarray>DOMStringArray</dfn>;
+typedef sequence<any> <dfn id=propertyvaluearray>PropertyValueArray</dfn>;
interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <span>NodeList</span> {
- attribute <a href=#domstringarray>DOMStringArray</a> <a href=#dom-propertynodelist-content title=dom-PropertyNodeList-content>content</a>;
+ attribute <a href=#propertyvaluearray>PropertyValueArray</a> <a href=#dom-propertynodelist-content title=dom-PropertyNodeList-content>content</a>;
};</pre>
<dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLPropertyCollection-length><a href=#dom-htmlpropertycollection-length>length</a></code></dt>
@@ -6512,9 +6518,7 @@
<dt><var title="">collection</var>[<var title="">name</var>]</dt>
<dt><var title="">collection</var>(<var title="">name</var>)</dt>
<dd>
- <p>Returns the element with that adds the property named <var title="">name</var> from the collection.</p>
- <p>If there are multiple matching elements, then a <code><a href=#propertynodelist>PropertyNodeList</a></code> object containing all those elements is returned.</p>
- <p>Returns null if no element adds the property named <var title="">name</var>.</p>
+ <p>Returns a <code><a href=#propertynodelist>PropertyNodeList</a></code> object containing any elements that add a property named <var title="">name</var>.</p>
</dd>
<dt><var title="">propertyNodeList</var> . <var title="">content</var></dt>
@@ -6537,6 +6541,13 @@
attribute must return the number of nodes <a href=#represented-by-the-collection>represented by the
collection</a>.</p>
+ <p>The <dfn id=dom-htmlpropertycollection-item title=dom-HTMLPropertyCollection-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 <span>names of the supported named properties</span> consist
+ of the <a href=#property-names>property names</a> of all the elements
+ <a href=#represented-by-the-collection>represented by the collection</a>.</p>
+
<p>The <dfn id=dom-htmlpropertycollection-names title=dom-HTMLPropertyCollection-names><code>names</code></dfn>
attribute must return a live <code>DOMStringList</code> object
giving the <a href=#property-names>property names</a> of all the elements
@@ -6545,39 +6556,23 @@
occurrence of each name. The same object must be returned each
time.</p>
- <p>The <dfn id=dom-htmlpropertycollection-item title=dom-HTMLPropertyCollection-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 id=dom-htmlpropertycollection-nameditem title=dom-HTMLPropertyCollection-namedItem><code>namedItem(<var title="">name</var>)</code></dfn> method must return a
+ <code><a href=#propertynodelist>PropertyNodeList</a></code> object representing a live view of the
+ <code><a href=#htmlpropertycollection-0>HTMLPropertyCollection</a></code> object, further filtered so that
+ the only nodes in the <code><a href=#radionodelist>RadioNodeList</a></code> object are those
+ that have a <a href=#property-names title="property names">property name</a> equal
+ to <var title="">name</var>. The nodes in the
+ <code><a href=#propertynodelist>PropertyNodeList</a></code> object must be sorted in <a href=#tree-order>tree
+ order</a>, and the same object must be returned each time a
+ particular <var title="">name</var> is queried.</p>
- <p>The <span>names of the supported named properties</span> consist
- of the <a href=#property-names>property names</a> of all the elements
- <a href=#represented-by-the-collection>represented by the collection</a>.</p>
-
- <p>The <dfn id=dom-htmlpropertycollection-nameditem title=dom-HTMLPropertyCollection-namedItem><code>namedItem(<var title="">name</var>)</code></dfn> method must act according to the
- following algorithm:</p>
-
- <ol><li>If, at the time the method is called, there is exactly one node
- in the collection that has a <a href=#property-names title="property names">property
- name</a> equal to <var title="">name</var>, then return that
- node and stop the algorithm.</li>
-
- <li>Otherwise, if there are no nodes in the collection that have a
- <a href=#property-names title="property names">property name</a> equal to <var title="">name</var>, then return null and stop the algorithm.</li>
-
- <li>Otherwise, create a <code><a href=#propertynodelist>PropertyNodeList</a></code> object
- representing a live view of the <code><a href=#htmlpropertycollection-0>HTMLPropertyCollection</a></code>
- object, further filtered so that the only nodes in the
- <code><a href=#radionodelist>RadioNodeList</a></code> object are those that have a <a href=#property-names title="property names">property name</a> equal to <var title="">name</var>. The nodes in the <code><a href=#propertynodelist>PropertyNodeList</a></code>
- object must be sorted in <a href=#tree-order>tree order</a>.</li>
-
- <li>Return that <code><a href=#propertynodelist>PropertyNodeList</a></code> object.</li>
-
- </ol><hr><p>A members of the <code><a href=#propertynodelist>PropertyNodeList</a></code> interface
+ <hr><p>A members of the <code><a href=#propertynodelist>PropertyNodeList</a></code> interface
inherited from the <code>NodeList</code> interface must behave as
they would on a <code>NodeList</code> object.</p>
<p>The <dfn id=dom-propertynodelist-content title=dom-PropertyNodeList-content><code>content</code></dfn> DOM
attribute on the <code><a href=#propertynodelist>PropertyNodeList</a></code> object, on getting,
- must return a newly constructed <code><a href=#domstringarray>DOMStringArray</a></code> whose
+ must return a newly constructed <code>DOMStringArray</code> whose
values are the values obtained from the <code title=dom-content><a href=#dom-content>content</a></code> DOM property of each of the
elements represented by the object, in <a href=#tree-order>tree order</a>.</p>
@@ -40959,7 +40954,8 @@
attribute returns an <code><a href=#htmlpropertycollection-0>HTMLPropertyCollection</a></code>, which can
be enumerated to go through each element that adds one or more
properties to the item. It can also be indexed by name, which will
- return the property with that name (if there is just one).</p>
+ return an object with a list of the elements that add properties
+ with that name.</p>
<p>Each element that adds a property also has a <code title=dom-content><a href=#dom-content>content</a></code> DOM attribute that returns its
value.
@@ -40971,39 +40967,34 @@
"net.example.name" property from that item.</p>
<pre>var user = getItems('net.example.user')[0];
-alert('Hello ' + user.properties['net.example.name'].content + '!');</pre>
+alert('Hello ' + user.properties['net.example.name'][0].content + '!');</pre>
</div>
- <p>When an item has multiple properties with the same name, the
- <code><a href=#htmlpropertycollection-0>HTMLPropertyCollection</a></code> returns a
- <code><a href=#propertynodelist>PropertyNodeList</a></code> object with all those properties
- instead of returning just one. The <code><a href=#propertynodelist>PropertyNodeList</a></code>
- object can be used to obtained all the values at once using
- <em>its</em> <code title=dom-PropertyNodeList-content><a href=#dom-propertynodelist-content>content</a></code> attribute, which
+ <p>The <code><a href=#htmlpropertycollection-0>HTMLPropertyCollection</a></code> object, when indexed by
+ name in this way, actually returns a <code><a href=#propertynodelist>PropertyNodeList</a></code>
+ object with all the matching properties. The
+ <code><a href=#propertynodelist>PropertyNodeList</a></code> object can be used to obtained all the
+ values at once using <em>its</em> <code title=dom-PropertyNodeList-content><a href=#dom-propertynodelist-content>content</a></code> attribute, which
returns an array of all the values.</p>
<div class=example>
<p>In an earlier example, a "com.example.feline" item had two
- "com.example.color" values. This script looks up such items and
- then lists all their values. Because it doesn't know ahead of time
- if the item has zero, one, or more colors, it checks whether the
- value returned from the <code><a href=#htmlpropertycollection-0>HTMLPropertyCollection</a></code> is a
- <code><a href=#propertynodelist>PropertyNodeList</a></code> (multiple colors), just a regular
- element (one color), or null (no colors) before using it.</p>
+ "com.example.color" values. This script looks up the first such
+ item and then lists all its values.</p>
<pre>var cat = getItems('com.example.feline')[0];
-var colors = cat.properties['com.example.color'];
+var colors = cat.properties['com.example.color'].content;
var result;
-if (!colors) {
+if (colors.length == 0) {
result = 'Color unknown.';
-} else if (colors instanceof PropertyNodeList) {
+} else if (colors.length == 1) {
+ result = 'Color: ' + colors[0];
+} else {
result = 'Colors:';
- for (var i = 0; i < colors.content.length; i += 1)
- result += ' ' + colors.content[i];
-} else {
- result = 'Color: ' + colors.content;
+ for (var i = 0; i < colors.length; i += 1)
+ result += ' ' + colors[i];
}</pre>
</div>
@@ -41278,12 +41269,16 @@
<dd><p>The value is the element's
<code><a href=#textcontent>textContent</a></code>.</dd>
- </dl><p>If a property's <a href=#concept-property-value title=concept-property-value>value</a>
+ </dl><p>The <dfn id=url-property-elements>URL property elements</dfn> are the <code><a href=#the-a-element>a</a></code>,
+ <code><a href=#the-area-element>area</a></code>, <code><a href=#audio>audio</a></code>, <code><a href=#the-embed-element>embed</a></code>,
+ <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>, <code><a href=#the-link-element>link</a></code>,
+ <code><a href=#the-object-element>object</a></code>, <code><a href=#the-source-element>source</a></code>, and <code><a href=#video>video</a></code>
+ elements.</p>
+
+ <p>If a property's <a href=#concept-property-value title=concept-property-value>value</a>
is an <a href=#absolute-url>absolute URL</a>, the property must be specified
- using an <code><a href=#the-a-element>a</a></code>, <code><a href=#the-area-element>area</a></code>, <code><a href=#audio>audio</a></code>,
- <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>,
- <code><a href=#the-link-element>link</a></code>, <code><a href=#the-object-element>object</a></code>, <code><a href=#the-source-element>source</a></code>, or
- <code><a href=#video>video</a></code> element.</p>
+ using an <a href=#url-property-elements title="URL property elements">URL property
+ element</a>.</p>
@@ -41478,29 +41473,8 @@
<li>First Last</li>
- </ul><p>User agents must run the following steps to convert the <code title=md-vcard-fn><a href=#md-vcard-fn>fn</a></code> property's <a href=#concept-property-value title=concept-property-value>value</a> into an implied
- <code title=md-vcard-n-family-name><a href=#md-vcard-n-family-name>family-name</a></code>/<code title=md-vcard-n-given-name><a href=#md-vcard-n-given-name>given-name</a></code> pair:</p>
+ </ul></dd>
- <ol><li><p>Let <var title="">value</var> be the <code title=md-vcard-fn><a href=#md-vcard-fn>fn</a></code> property's <a href=#concept-property-value title=concept-property-value>value</a>.</li>
-
- <li><p><a href=#split-a-string-on-spaces title="split a string on spaces">Split <var title="">value</var> on spaces</a>, and let <var title="">part one</var> be the first resulting token, and <var title="">part two</var> be the second.</li>
-
- <li><p>If the last character of <var title="">part one</var> is
- a U+002C COMMA character (,), then remove that character from
- <var title="">part one</var> and let the implied <code title=md-vcard-n-family-name><a href=#md-vcard-n-family-name>family-name</a></code> be <var title="">part one</var> and the implied <code title=md-vcard-n-given-name><a href=#md-vcard-n-given-name>given-name</a></code> be <var title="">part two</var>.</li>
-
- <li><p>Otherwise, if <var title="">part two</var> is two
- Unicode code-points long and its second character is a U+002E
- FULL STOP character (.), then let the implied <code title=md-vcard-n-family-name><a href=#md-vcard-n-family-name>family-name</a></code> be <var title="">part one</var> and the implied <code title=md-vcard-n-given-name><a href=#md-vcard-n-given-name>given-name</a></code> be the first
- character of <var title="">part two</var>.</li>
-
- <li><p>Otherwise, if <var title="">part two</var> is one
- Unicode code-point long, then let the implied <code title=md-vcard-n-family-name><a href=#md-vcard-n-family-name>family-name</a></code> be <var title="">part one</var> and the implied <code title=md-vcard-n-given-name><a href=#md-vcard-n-given-name>given-name</a></code> be <var title="">part two</var>.</li>
-
- <li><p>Otherwise, let the implied <code title=md-vcard-n-family-name><a href=#md-vcard-n-family-name>family-name</a></code> be <var title="">part two</var> and the implied <code title=md-vcard-n-given-name><a href=#md-vcard-n-given-name>given-name</a></code> be <var title="">part one</var>.</li>
-
- </ol></dd>
-
</dl></dd>
<dt><dfn id=md-vcard-n-family-name title=md-vcard-n-family-name><code>family-name</code></dfn> (inside <code title=md-vcard-n><a href=#md-vcard-n>n</a></code>)</dt>
@@ -42479,7 +42453,7 @@
(<span itemprop="organization-unit">Los Angeles Division</span>)
</p>
<p>
- <span class="adr" item>
+ <span itempror="adr" item>
<span itemprop="street-address">10201 W. Pico Blvd.</span><br>
<span itemprop="locality">Los Angeles</span>,
<span itemprop="region">CA</span>
@@ -42558,7 +42532,7 @@
to events are used here; this vocabulary cannot express a complete
iCalendar instance.</p>
- <dl><dt><dfn id=md-vcevent-attach title=md-vcevent-attach><code>attach</code></dfn></dt>
+ <dl><dt><dfn id=md-vevent-attach title=md-vevent-attach><code>attach</code></dfn></dt>
<dd>
@@ -42567,7 +42541,7 @@
<p>The <a href=#concept-property-value title=concept-property-value>value</a> must be
an <a href=#absolute-url>absolute URL</a>.</p>
- <p>Any number of properties with the name <code title=md-vcard-attach>attach</code> may be present within each
+ <p>Any number of properties with the name <code title=md-vevent-attach><a href=#md-vevent-attach>attach</a></code> may be present within each
<a href=#concept-item title=concept-item>item</a> with the type <code title=md-vevent><a href=#md-vevent>vevent</a></code>.</p>
</dd>
@@ -43125,9 +43099,8 @@
}
for (var nameIndex = 0; nameIndex < prop.itemprop.length; nameIndex += 1) {
var name = prop.itemprop[nameIndex];
- if (!name.match(':') && !name.match('.')) {
+ if (!name.match(':') && !name.match('.'))
calendar += name.toUpperCase() + parameters + ':' + value + '\r\n';
- }
}
}
calendar += 'END:VEVENT\r\nEND:VCALENDAR\r\n';
@@ -43902,7 +43875,11 @@
<h3 id=converting-html-to-other-formats><span class=secno>5.5 </span>Converting HTML to other formats</h3>
+ <p>In all these algorithms, unless otherwise stated, operations that
+ iterate over a series of elements (whether items, properties, or
+ otherwise) must do so in <a href=#tree-order>tree order</a>.</p>
+
<h4 id=json><span class=secno>5.5.1 </span>JSON</h4>
<p>Given a node <var title="">node</var> in a <code>Document</code>,
@@ -44119,10 +44096,10 @@
<ol><li><p>If of the elements whose <a href=#concept-item-corresponding title=concept-item-corresponding>corresponding item</a> is
<var title="">item</var>, exactly one has a <a href=#property-names title="property
- names">property name</a> equal to the string "<code title="">about</code>", and the <a href=#concept-property-value title=concept-property-value>property value</a> of that
- element is an <a href=#absolute-url>absolute URL</a>, let <var title="">subject</var> be that <a href=#absolute-url>absolute
- URL</a>. Otherwise, let <var title="">subject</var> be a new
- blank node.</li>
+ names">property name</a> equal to the string "<code title="">about</code>", and that element is a <a href=#url-property-elements title="URL
+ property elements">URL property element</a>, let <var title="">subject</var> be the <a href=#concept-property-value title=concept-property-value>value</a> of that
+ property. Otherwise, let <var title="">subject</var> be a new blank
+ node.</li>
<li>
@@ -44160,14 +44137,10 @@
reserialise it, check if the <time> was valid, check if it had a
.date, a .time, a .timezone, etc. -->
- <li><p>Otherwise, if <var title="">element</var> is not an
- <code><a href=#the-a-element>a</a></code>, <code><a href=#the-area-element>area</a></code>, <code><a href=#audio>audio</a></code>,
- <code><a href=#the-embed-element>embed</a></code>, <code><a href=#the-iframe-element>iframe</a></code>, <code><a href=#the-img-element>img</a></code>,
- <code><a href=#the-link-element>link</a></code>, <code><a href=#the-object-element>object</a></code>, <code><a href=#the-source-element>source</a></code>, or
- <code><a href=#video>video</a></code> element, let <var title="">value</var> be a
- plain literal, with the language information set from the
- <a href=#language>language</a> of the element, if it is not
- unknown.</li>
+ <li><p>Otherwise, if <var title="">element</var> is not one of
+ the <a href=#url-property-elements>URL property elements</a>, let <var title="">value</var> be a plain literal, with the language
+ information set from the <a href=#language>language</a> of the element, if
+ it is not unknown.</li>
<li>
@@ -44198,9 +44171,518 @@
</ol><h4 id=vcard-0><span class=secno>5.5.3 </span>vCard</h4>
- <p class=XXX>...</p>
+ <p>Given a node <var title="">node</var> in a <code>Document</code>,
+ a user agent must run the following algorithm to <dfn id=extracting-a-vcard title="extracting a vCard">extract any <code title=md-vcard>vcard</code> data represented by that
+ node</dfn>:</p>
+ <ol><li>
+ <p>If <var title="">node</var> is not an element that is an <a href=#concept-item title=concept-item>item</a> with the type <code title=md-vcard><a href=#md-vcard>vcard</a></code>, then run these substeps:</p>
+
+ <ol><li><p>If <var title="">node</var> has no parent, then there is
+ no vCard. Abort the algorithm, returning nothing.</li>
+
+ <li><p>Let <var title="">node</var> be <var title="">node</var>'s
+ parent.</li>
+
+ <li><p>Restart the entire algorithm with the new value of <var title="">node</var>.</li>
+
+ </ol></li>
+
+ <li><p>Let <var title="">output</var> be an empty string.</li>
+
+ <li><p><a href=#add-a-vcard-line>Add a vCard line</a> with the type "<code title="">BEGIN</code>" and the value "<code title="">VCARD</code>"
+ to <var title="">output</var>.</li>
+
+ <li><p><a href=#add-a-vcard-line>Add a vCard line</a> with the type "<code title="">PROFILE</code>" and the value "<code title="">VCARD</code>"
+ to <var title="">output</var>.</li>
+
+ <li><p><a href=#add-a-vcard-line>Add a vCard line</a> with the type "<code title="">VERSION</code>" and the value "<code title="">3.0</code>"
+ to <var title="">output</var>.</li>
+
+ <li><p><a href=#add-a-vcard-line>Add a vCard line</a> with the type "<code title="">SOURCE</code>" and <a href="#the-document's-current-address">the document's current
+ address</a> as the value to <var title="">output</var>.</li>
+
+ <li><p>If <a href=#the-title-element-0>the <code>title</code> element</a> is not null,
+ <a href=#add-a-vcard-line>add a vCard line</a> with the type "<code title="">NAME</code>" and the <code><a href=#textcontent>textContent</a></code> of <a href=#the-title-element-0>the
+ <code>title</code> element</a> as the value to <var title="">output</var>.</li>
+
+ <li>
+
+ <p>For each element <var title="">element</var> that has one or
+ more <a href=#property-names>property names</a> and whose <a href=#concept-item-corresponding title=concept-item-corresponding>corresponding item</a> is
+ <var title="">node</var>: for each name <var title="">name</var>
+ in <var title="">element</var>'s <a href=#property-names>property names</a>, run
+ the following substeps:</p>
+
+ <ol><li><p>If <var title="">name</var> is equal to the string
+ "<code title="">about</code>", skip this name.</li>
+
+ <li><p>Let <var title="">parameters</var> be an empty set of
+ name-value pairs.</li>
+
+ <li>
+
+ <p>Run the appropriate set of substeps from the following
+ list. The steps will set a variable <var title="">value</var>,
+ which is used in the next step.</p>
+
+ <dl><dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is an <a href=#concept-item title=concept-item>item</a> <var title="">subitem</var>
+ and <var title="">name</var> is <code title=md-vcard-n><a href=#md-vcard-n>n</a></code></dt>
+
+ <dd>
+
+ <ol><li><p>Let <var title="">n1</var> be the <a href=#concept-property-value title=concept-property-value>value</a> of the first
+ property named <code title=md-vcard-n-family-name><a href=#md-vcard-n-family-name>family-name</a></code> in <var title="">subitem</var>, or the empty string if there is no
+ such property or the property's value is itself an <a href=#concept-item title=concept-item>item</a>.</li>
+
+ <li><p>Let <var title="">n2</var> be the <a href=#concept-property-value title=concept-property-value>value</a> of the first
+ property named <code title=md-vcard-n-given-name><a href=#md-vcard-n-given-name>given-name</a></code> in <var title="">subitem</var>, or the empty string if there is no
+ such property or the property's value is itself an <a href=#concept-item title=concept-item>item</a>.</li>
+
+ <li><p>Let <var title="">n3</var> be the <a href=#concept-property-value title=concept-property-value>value</a> of the first
+ property named <code title=md-vcard-n-additional-name><a href=#md-vcard-n-additional-name>additional-name</a></code> in
+ <var title="">subitem</var>, or the empty string if there is
+ no such property or the property's value is itself an <a href=#concept-item title=concept-item>item</a>.</li>
+
+ <li><p>Let <var title="">n4</var> be the <a href=#concept-property-value title=concept-property-value>value</a> of the first
+ property named <code title=md-vcard-n-honorific-prefix><a href=#md-vcard-n-honorific-prefix>honorific-prefix</a></code>
+ in <var title="">subitem</var>, or the empty string if there
+ is no such property or the property's value is itself an
+ <a href=#concept-item title=concept-item>item</a>.</li>
+
+ <li><p>Let <var title="">n5</var> be the <a href=#concept-property-value title=concept-property-value>value</a> of the first
+ property named <code title=md-vcard-n-honorific-suffix><a href=#md-vcard-n-honorific-suffix>honorific-suffix</a></code>
+ in <var title="">subitem</var>, or the empty string if there
+ is no such property or the property's value is itself an
+ <a href=#concept-item title=concept-item>item</a>.</li>
+
+ <li>
+
+ <p>Let <var title="">value</var> be the concatenation of the
+ following, in this order:</p>
+
+ <ol class=brief><li>The result of <a href=#escaping-the-vcard-text-string>escaping the vCard text string</a> <var title="">n1</var></li>
+ <li>A U+003B SEMICOLON character (;)</li>
+ <li>The result of <a href=#escaping-the-vcard-text-string>escaping the vCard text string</a> <var title="">n2</var></li>
+ <li>A U+003B SEMICOLON character (;)</li>
+ <li>The result of <a href=#escaping-the-vcard-text-string>escaping the vCard text string</a> <var title="">n3</var></li>
+ <li>A U+003B SEMICOLON character (;)</li>
+ <li>The result of <a href=#escaping-the-vcard-text-string>escaping the vCard text string</a> <var title="">n4</var></li>
+ <li>A U+003B SEMICOLON character (;)</li>
+ <li>The result of <a href=#escaping-the-vcard-text-string>escaping the vCard text string</a> <var title="">n5</var></li>
+ </ol></li>
+
+ </ol></dd>
+
+ <dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is an <a href=#concept-item title=concept-item>item</a> <var title="">subitem</var>
+ and <var title="">name</var> is <code title=md-vcard-adr><a href=#md-vcard-adr>adr</a></code></dt>
+
+ <dd>
+
+ <ol><li><p>Let <var title="">value</var> be the empty
+ string.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-vcard-subproperties>collecting vCard subproperties</a> named <code title=md-vcard-adr-post-office-box><a href=#md-vcard-adr-post-office-box>post-office-box</a></code>
+ in <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-vcard-subproperties>collecting vCard subproperties</a> named <code title=md-vcard-adr-extended-address><a href=#md-vcard-adr-extended-address>extended-address</a></code>
+ in <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-vcard-subproperties>collecting vCard subproperties</a> named <code title=md-vcard-adr-street-address><a href=#md-vcard-adr-street-address>street-address</a></code> in
+ <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
+ <code title=md-vcard-adr-locality><a href=#md-vcard-adr-locality>locality</a></code> in <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
+ <code title=md-vcard-adr-region><a href=#md-vcard-adr-region>region</a></code> in <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
+ <code title=md-vcard-adr-postal-code><a href=#md-vcard-adr-postal-code>postal-code</a></code> in
+ <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
+ <code title=md-vcard-adr-country-name><a href=#md-vcard-adr-country-name>country-name</a></code>
+ in <var title="">subitem</var>.</p>
+
+ <li><p>If there is a property named <code title=md-vcard-adr-type><a href=#md-vcard-adr-type>type</a></code> in <var title="">subitem</var>, and the first such property has a
+ <a href=#concept-property-value title=concept-property-value>value</a> that is not
+ an <a href=#concept-item title=concept-item>item</a> and whose value
+ consists only of <a href=#alphanumeric-ascii-characters>alphanumeric ASCII characters</a>,
+ then add a parameter named "<code title="">TYPE</code>" whose
+ value is the <a href=#concept-property-value title=concept-property-value>value</a> of that property
+ to <var title="">parameters</var>.</li>
+
+ </ol></dd>
+
+ <dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is an <a href=#concept-item title=concept-item>item</a> <var title="">subitem</var>
+ and <var title="">name</var> is <code title=md-vcard-org><a href=#md-vcard-org>org</a></code></dt>
+
+ <dd>
+
+ <ol><li><p>Let <var title="">value</var> be the empty
+ string.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
+ <code title=md-vcard-org-organization-name><a href=#md-vcard-org-organization-name>organization-name</a></code>
+ in <var title="">subitem</var>.</p>
+
+ <li>
+
+ <p>For each property named <code title=md-vcard-org-organization-unit><a href=#md-vcard-org-organization-unit>organization-unit</a></code>
+ in <var title="">subitem</var>, run the following steps:</p>
+
+ <ol><li><p>If the <a href=#concept-property-value title=concept-property-value>value</a> of the property
+ is an <a href=#concept-item title=concept-item>item</a>, then skip
+ this property.</li>
+
+ <li><p>Append a U+003B SEMICOLON character (;) to <var title="">value</var>.</li>
+
+ <li><p>Append the result of <a href=#escaping-the-vcard-text-string>escaping the vCard text
+ string</a> given by the <a href=#concept-property-value title=concept-property-value>value</a> of the property
+ to <var title="">value</var>.</li>
+
+ </ol></li>
+
+ </ol></dd>
+
+ <dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is an <a href=#concept-item title=concept-item>item</a> <var title="">subitem</var>
+ with the type <code title=md-vcard><a href=#md-vcard>vcard</a></code> and <var title="">name</var> is <code title=md-vcard-agent><a href=#md-vcard-agent>agent</a></code></dt>
+
+ <dd>
+
+ <ol><li><p>Let <var title="">value</var> be the result of
+ <a href=#escaping-the-vcard-text-string>escaping the vCard text string</a> obtained from
+ <a href=#extracting-a-vcard>extracting a vCard</a> from the element that
+ represents <var title="">subitem</var>.</li>
+
+ <li><p>Add a parameter named "<code title="">VALUE</code>"
+ whose value is "<code title="">VCARD</code>" to <var title="">parameters</var>.</li>
+
+ </ol></dd>
+
+ <dt>If the property's <a href=#concept-property-value title=concept-property-value>value</a> is an <a href=#concept-item title=concept-item>item</a> and <var title="">name</var>
+ is none of the above</dt>
+
+ <dd>
+
+ <ol><li><p>Let <var title="">value</var> the result of
+ <a href=#collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</a> named
+ <code title="">value</code> in <var title="">subitem</var>.</p>
+
+ <li><p>If there is a property named <code title="">type</code> in <var title="">subitem</var>, and the
+ first such property has a <a href=#concept-property-value title=concept-property-value>value</a> that is not an
+ <a href=#concept-item title=concept-item>item</a> and whose value
+ consists only of <a href=#alphanumeric-ascii-characters>alphanumeric ASCII characters</a>,
+ then add a parameter named "<code title="">TYPE</code>" whose
+ value is the <a href=#concept-property-value title=concept-property-value>value</a> of that property
+ to <var title="">parameters</var>.</li>
+
+ </ol></dd>
+
+ <dt>Otherwise (the property's <a href=#concept-property-value title=concept-property-value>value</a> is not an <a href=#concept-item title=concept-item>item</a>)</dt>
+
+ <dd>
+
+ <ol><li><p>Let <var title="">value</var> be the property's <a href=#concept-property-value title=concept-property-value>value</a>.</li>
+
+ <li><p>If <var title="">element</var> is one of the <a href=#url-property-elements>URL
+ property elements</a>, add a parameter with the name "<code title="">VALUE</code>" and the value "<code title="">URI</code>" to <var title="">parameters</var>.</li>
+
+ <li><p>Otherwise, if <var title="">element</var> is a
+ <code><a href=#the-time-element>time</a></code> element and the <var title="">value</var> is
+ a <a href=#valid-date-string>valid date string</a>, add a parameter with the name
+ "<code title="">VALUE</code>" and the value "<code title="">DATE</code>" to <var title="">parameters</var>.</li>
+
+ <li><p>Otherwise, if <var title="">element</var> is a
+ <code><a href=#the-time-element>time</a></code> element and the <var title="">value</var> is
+ a <a href=#valid-global-date-and-time-string>valid global date and time string</a>, add a
+ parameter with the name "<code title="">VALUE</code>" and the
+ value "<code title="">DATE-TIME</code>" to <var title="">parameters</var>.</li>
+
+ <li><p>Prefix every U+005C REVERSE SOLIDUS character (\) in
+ <var title="">value</var> with another U+005C REVERSE SOLIDUS
+ character (\).</li>
+
+ <li><p>Prefix every U+002C COMMA character (,) in <var title="">value</var> with a U+005C REVERSE SOLIDUS character
+ (\).</li>
+
+ <li><p>Unless <var title="">name</var> is <code title=md-vcard-geo><a href=#md-vcard-geo>geo</a></code>, prefix every U+003B SEMICOLON
+ character (;) in <var title="">value</var> with a U+005C
+ REVERSE SOLIDUS character (\).</li>
+
+ <li><p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED
+ character pair (CRLF) in <var title="">value</var> with a U+005C REVERSE
+ SOLIDUS character (\) followed by a U+006E LATIN SMALL LETTER
+ N.</li>
+
+ <li><p>Replace every remaining U+000D CARRIAGE RETURN (CR) or
+ U+000A LINE FEED (LF) character in <var title="">value</var>
+ with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E
+ LATIN SMALL LETTER N.</li>
+
+ </ol></dd>
+
+ </dl></li>
+
+ <li>
+
+ <p><a href=#add-a-vcard-line>Add a vCard line</a> with the type <var title="">name</var>, the parameters <var title="">parameters</var>, and the value <var title="">value</var> to <var title="">output</var>.</p>
+
+ </li>
+
+ </ol></li>
+
+ <li>
+
+ <p>If there is no property named <code title=md-vcard-n><a href=#md-vcard-n>n</a></code>
+ whose <a href=#concept-item-corresponding title=concept-item-corresponding>corresponding
+ item</a> is <var title="">node</var>, then run the following
+ substeps:</p>
+
+ <ol><li><p>If there is no property named <code title=md-vcard-fn><a href=#md-vcard-fn>fn</a></code> whose <a href=#concept-item-corresponding title=concept-item-corresponding>corresponding item</a> is
+ <var title="">node</var>, then skip the remainder of these
+ substeps.</li>
+
+ <li><p>If the first property named <code title=md-vcard-fn><a href=#md-vcard-fn>fn</a></code> whose <a href=#concept-item-corresponding title=concept-item-corresponding>corresponding item</a> is
+ <var title="">node</var> has a <a href=#concept-property-value title=concept-property-value>value</a> that is an <a href=#concept-item title=concept-item>item</a>, then skip the remainder of
+ these substeps.</li>
+
+ <li><p>Let <var title="">fn</var> be the <a href=#concept-property-value title=concept-property-value>value</a> of the first property
+ named <code title=md-vcard-fn><a href=#md-vcard-fn>fn</a></code> whose <a href=#concept-item-corresponding title=concept-item-corresponding>corresponding item</a> is
+ <var title="">node</var>.</li>
+
+ <li><p>If there is a property named <code title=md-vcard-org><a href=#md-vcard-org>org</a></code> whose <a href=#concept-item-corresponding title=concept-item-corresponding>corresponding item</a> is
+ <var title="">node</var>, and the <a href=#concept-property-value title=concept-property-value>value</a> of the first such
+ property is equal to <var title="">fn</var> (and is not an <a href=#concept-item title=concept-item>item</a>), then <a href=#add-a-vcard-line>add a vCard
+ line</a> with the type "<code title="">N</code>" whose value
+ is four U+003B SEMICOLON characters ("<code title="">;;;;</code>") to <var title="">output</var>. Then, skip
+ the remainder of these substeps.</li>
+
+ <li><p>If the <a href=#space-character title="space character">space
+ characters</a> in <var title="">fn</var>, if any, are not all
+ contiguous, then skip the remainder of these substeps.</li>
+
+ <li><p><a href=#split-a-string-on-spaces title="split a string on spaces">Split <var title="">fn</var> on spaces</a>, and let <var title="">part
+ one</var> be the first resulting token, and <var title="">part
+ two</var> be the second, if any, or the empty string if there is
+ no second token. (There cannot be three, given the previous
+ step.)</li>
+
+ <li>
+
+ <p>If the last character of <var title="">part one</var> is a
+ U+002C COMMA character (,), then remove that character from <var title="">part one</var> and <a href=#add-a-vcard-line>add a vCard line</a> with
+ the type "<code title="">N</code>" whose value is the
+ concatenation of the following strings:</p>
+
+ <ol class=brief><li>The result of <a href=#escaping-the-vcard-text-string>escaping the vCard text string</a> <var title="">part one</var></li>
+ <li>A U+003B SEMICOLON character (;)</li>
+ <li>The result of <a href=#escaping-the-vcard-text-string>escaping the vCard text string</a> <var title="">part two</var></li>
+ <li>Three U+003B SEMICOLON characters (;)</li>
+ </ol><p>Then, skip the remainder of these substeps.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">part two</var> is two Unicode code-points
+ long and its second character is a U+002E FULL STOP character
+ (.), then <a href=#add-a-vcard-line>add a vCard line</a> with the type "<code title="">N</code>" whose value is the concatenation of the
+ following strings:</p>
+
+ <ol class=brief><li>The result of <a href=#escaping-the-vcard-text-string>escaping the vCard text string</a> <var title="">part one</var></li>
+ <li>A U+003B SEMICOLON character (;)</li>
+ <li>The result of <a href=#escaping-the-vcard-text-string>escaping the vCard text string</a> consisting of the first character of <var title="">part two</var></li>
+ <li>Three U+003B SEMICOLON characters (;)</li>
+ </ol><p>Then, skip the remainder of these substeps.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">part two</var> is one Unicode code-point
+ long, then <a href=#add-a-vcard-line>add a vCard line</a> with the type "<code title="">N</code>" whose value is the concatenation of the
+ following strings:</p>
+
+ <ol class=brief><li>The result of <a href=#escaping-the-vcard-text-string>escaping the vCard text string</a> <var title="">part one</var></li>
+ <li>A U+003B SEMICOLON character (;)</li>
+ <li>The result of <a href=#escaping-the-vcard-text-string>escaping the vCard text string</a> <var title="">part two</var></li>
+ <li>Three U+003B SEMICOLON characters (;)</li>
+ </ol><p>Then, skip the remainder of these substeps.</p>
+
+ </li>
+
+ <li>
+
+ <p><a href=#add-a-vcard-line>Add a vCard line</a> with the type "<code title="">N</code>" whose value is the concatenation of the
+ following strings:</p>
+
+ <ol class=brief><li>The result of <a href=#escaping-the-vcard-text-string>escaping the vCard text string</a> <var title="">part two</var></li>
+ <li>A U+003B SEMICOLON character (;)</li>
+ <li>The result of <a href=#escaping-the-vcard-text-string>escaping the vCard text string</a> <var title="">part one</var></li>
+ <li>Three U+003B SEMICOLON characters (;)</li>
+ </ol></li>
+
+ </ol></li>
+
+ <li><p><a href=#add-a-vcard-line>Add a vCard line</a> with the type "<code title="">END</code>" and the value "<code title="">VCARD</code>"
+ to <var title="">output</var>.</li>
+
+ </ol><p>When the above algorithm says that the user agent is to <dfn id=add-a-vcard-line>add
+ a vCard line</dfn> consisting of a type <var title="">type</var>,
+ optionally some parameters, and a value <var title="">value</var> to
+ a string <var title="">output</var>, it must run the following
+ steps:</p>
+
+ <ol><li><p>Let <var title="">line</var> be an empty string.
+
+ <li><p>Append <var title="">type</var>, <a href=#converted-to-uppercase>converted to
+ uppercase</a>, to <var title="">line</var>.</li>
+
+ <li>
+
+ <p>If there are any parameters, then for each parameter, in the
+ order that they were added, run these substeps:</p>
+
+ <ol><li><p>Append a U+003B SEMICOLON character (;) to <var title="">line</var>.</li>
+
+ <li><p>Append the parameter's name to <var title="">line</var>.</li>
+
+ <li><p>Append a U+003D EQUALS SIGN character (=) to <var title="">line</var>.</li>
+
+ <li><p>Append the parameter's value to <var title="">line</var>.</li>
+
+ </ol></li>
+
+ <li><p>Append a U+003A COLON character (:) to <var title="">line</var>.</li>
+
+ <li><p>Append <var title="">value</var> to <var title="">line</var>.</li>
+
+ <li><p>Let <var title="">maximum length</var> be 75.</li>
+
+ <li>
+
+ <p>If and while <var title="">line</var> is longer than <var title="">maximum length</var> Unicode code points long, run the
+ following substeps:</p>
+
+ <ol><li><p>Append the first <var title="">maximum length</var>
+ Unicode code points of <var title="">line</var> to <var title="">output</var>.</li>
+
+ <li><p>Remove the first <var title="">maximum length</var>
+ Unicode code points from <var title="">line</var>.</li>
+
+ <li><p>Append a U+000D CARRIAGE RETURN character (CR) to <var title="">output</var>.</li>
+
+ <li><p>Append a U+000A LINE FEED character (LF) to <var title="">output</var>.</li>
+
+ <li><p>Append a U+0020 SPACE character to <var title="">output</var>.</li>
+
+ <li><p>Let <var title="">maximum length</var> be 74.</li>
+
+ </ol></li>
+
+ <li><p>Append (what remains of) <var title="">line</var> to <var title="">output</var>.</li>
+
+ <li><p>Append a U+000D CARRIAGE RETURN character (CR) to <var title="">output</var>.</li>
+
+ <li><p>Append a U+000A LINE FEED character (LF) to <var title="">output</var>.</li>
+
+ </ol><p>When the steps above require the user agent to obtain the result
+ of <dfn id=collecting-vcard-subproperties>collecting vCard subproperties</dfn> named <var title="">subname</var> in <var title="">subitem</var>, the user
+ agent must run the following steps:</p>
+
+ <ol><li><p>Let <var title="">value</var> be the empty string.</li>
+
+ <li>
+
+ <p>For each property named <var title="">subname</var> in the item
+ <var title="">subitem</var>, run the following substeps:</p>
+
+ <ol><li><p>If the <a href=#concept-property-value title=concept-property-value>value</a>
+ of the property is itself an <a href=#concept-item title=concept-item>item</a>, then skip this
+ property.</li>
+
+ <li><p>If this is not the first property named <var title="">subname</var> in <var title="">subitem</var> (ignoring
+ any that were skipped by the previous step), then append a U+002C
+ COMMA character (,) to <var title="">value</var>.</li>
+
+ <li><p>Append the result of <a href=#escaping-the-vcard-text-string>escaping the vCard text
+ string</a> given by the <a href=#concept-property-value title=concept-property-value>value</a> of the property to
+ <var title="">value</var>.</li>
+
+ </ol></li>
+
+ <li><p>Return <var title="">value</var>.</li>
+
+ </ol><p>When the steps above require the user agent to obtain the result
+ of <dfn id=collecting-the-first-vcard-subproperty>collecting the first vCard subproperty</dfn> named <var title="">subname</var> in <var title="">subitem</var>, the user
+ agent must run the following steps:</p>
+
+ <ol><li><p>If there are no properties named <var title="">subname</var>
+ in <var title="">subitem</var>, then abort these substeps,
+ returning the empty string.</li>
+
+ <li><p>If the <a href=#concept-property-value title=concept-property-value>value</a> of
+ the first property named <var title="">subname</var> in <var title="">subitem</var> is an <a href=#concept-item title=concept-item>item</a>, then abort these substeps,
+ returning the empty string.</li>
+
+ <li><p>Return the result of <a href=#escaping-the-vcard-text-string>escaping the vCard text
+ string</a> given by the <a href=#concept-property-value title=concept-property-value>value</a> of the first property
+ named <var title="">subname</var> in <var title="">subitem</var>.</li>
+
+ </ol><p>When the above algorithms say the user agent is to <dfn id=escaping-the-vcard-text-string title="escaping the vCard text string">escape the vCard text
+ string</dfn> <var title="">value</var>, the user agent must use the
+ following steps:</p>
+
+ <ol><li><p>Prefix every U+005C REVERSE SOLIDUS character (\) in <var title="">value</var> with another U+005C REVERSE SOLIDUS character
+ (\).</li>
+
+ <li><p>Prefix every U+002C COMMA character (,) in <var title="">value</var> with a U+005C REVERSE SOLIDUS character
+ (\).</li>
+
+ <li><p>Prefix every U+003B SEMICOLON character (;) in <var title="">value</var> with a U+005C REVERSE SOLIDUS character
+ (\).</li>
+
+ <li><p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED
+ character pair (CRLF) in <var title="">value</var> with a U+005C
+ REVERSE SOLIDUS character (\) followed by a U+006E LATIN SMALL
+ LETTER N.</li>
+
+ <li><p>Replace every remaining U+000D CARRIAGE RETURN (CR) or
+ U+000A LINE FEED (LF) character in <var title="">value</var> with a
+ U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN
+ SMALL LETTER N.</li>
+
+ <li><p>Return the mutated <var title="">value</var>.</li>
+
+ </ol><p class=note>This algorithm can generate invalid vCard output, if
+ the input does not conform to the rules described for the <code title=md-vcard><a href=#md-vcard>vcard</a></code> <a href=#predefined-type>predefined type</a> and <a href=#predefined-property-name title="predefined property name">predefined property
+ names</a>.</p> <!-- of course since vcard doesn't define error
+ handling, this is somewhat problematic. -->
+
+
<h4 id=icalendar><span class=secno>5.5.4 </span>iCalendar</h4>
<p class=XXX>...</p>
Modified: source
===================================================================
--- source 2009-05-15 00:36:49 UTC (rev 3104)
+++ source 2009-05-16 02:02:46 UTC (rev 3105)
@@ -1162,6 +1162,11 @@
those that have the Unicode property "White_Space". <a
href="#refsUNICODE">[UNICODE]</a></p>
+ <p>The <dfn>alphanumeric ASCII characters</dfn> are those in the
+ ranges U+0030 DIGIT ZERO .. U+0039 DIGIT NINE, U+0041 LATIN CAPITAL
+ LETTER A .. U+005A LATIN CAPITAL LETTER Z, U+0061 LATIN SMALL LETTER
+ A .. U+007A LATIN SMALL LETTER Z.</p>
+
<p>Some of the micro-parsers described below follow the pattern of
having an <var title="">input</var> variable that holds the string
being parsed, and having a <var title="">position</var> variable
@@ -6453,15 +6458,16 @@
<pre class="idl">[Callable=<span title="dom-HTMLPropertyCollection-namedItem">namedItem</span>]
interface <dfn>HTMLPropertyCollection</dfn> {
readonly attribute unsigned long <span title="dom-HTMLPropertyCollection-length">length</span>;
+ [IndexGetter] <span>HTMLElement</span> <span title="dom-HTMLPropertyCollection-item">item</span>(in unsigned long index);
+
readonly attribute <span>DOMStringList</span> <span title="dom-HTMLPropertyCollection-names">names</span>;
- [IndexGetter] <span>HTMLElement</span> <span title="dom-HTMLPropertyCollection-item">item</span>(in unsigned long index);
- [NameGetter] Object <span title="dom-HTMLPropertyCollection-namedItem">namedItem</span>(in DOMString name);
+ [NameGetter] <span>PropertyNodeList</span> <span title="dom-HTMLPropertyCollection-namedItem">namedItem</span>(in DOMString name);
};
-typedef sequence<DOMString> <dfn>DOMStringArray</dfn>;
+typedef sequence<any> <dfn>PropertyValueArray</dfn>;
interface <dfn>PropertyNodeList</dfn> : <span>NodeList</span> {
- attribute <span>DOMStringArray</span> <span title="dom-PropertyNodeList-content">content</span>;
+ attribute <span>PropertyValueArray</span> <span title="dom-PropertyNodeList-content">content</span>;
};</pre>
<dl class="domintro">
@@ -6488,9 +6494,7 @@
<dt><var title="">collection</var>[<var title="">name</var>]</dt>
<dt><var title="">collection</var>(<var title="">name</var>)</dt>
<dd>
- <p>Returns the element with that adds the property named <var title="">name</var> from the collection.</p>
- <p>If there are multiple matching elements, then a <code>PropertyNodeList</code> object containing all those elements is returned.</p>
- <p>Returns null if no element adds the property named <var title="">name</var>.</p>
+ <p>Returns a <code>PropertyNodeList</code> object containing any elements that add a property named <var title="">name</var>.</p>
</dd>
<dt><var title="">propertyNodeList</var> . <var title="">content</var></dt>
@@ -6519,15 +6523,6 @@
collection</span>.</p>
<p>The <dfn
- title="dom-HTMLPropertyCollection-names"><code>names</code></dfn>
- attribute must return a live <code>DOMStringList</code> object
- giving the <span>property names</span> of all the elements
- <span>represented by the collection</span>, listed in <span>tree
- order</span>, but with duplicates removed, leaving only the first
- occurrence of each name. The same object must be returned each
- time.</p>
-
- <p>The <dfn
title="dom-HTMLPropertyCollection-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
@@ -6539,33 +6534,26 @@
<span>represented by the collection</span>.</p>
<p>The <dfn
+ title="dom-HTMLPropertyCollection-names"><code>names</code></dfn>
+ attribute must return a live <code>DOMStringList</code> object
+ giving the <span>property names</span> of all the elements
+ <span>represented by the collection</span>, listed in <span>tree
+ order</span>, but with duplicates removed, leaving only the first
+ occurrence of each name. The same object must be returned each
+ time.</p>
+
+ <p>The <dfn
title="dom-HTMLPropertyCollection-namedItem"><code>namedItem(<var
- title="">name</var>)</code></dfn> method must act according to the
- following algorithm:</p>
+ title="">name</var>)</code></dfn> method must return a
+ <code>PropertyNodeList</code> object representing a live view of the
+ <code>HTMLPropertyCollection</code> object, further filtered so that
+ the only nodes in the <code>RadioNodeList</code> object are those
+ that have a <span title="property names">property name</span> equal
+ to <var title="">name</var>. The nodes in the
+ <code>PropertyNodeList</code> object must be sorted in <span>tree
+ order</span>, and the same object must be returned each time a
+ particular <var title="">name</var> is queried.</p>
- <ol>
-
- <li>If, at the time the method is called, there is exactly one node
- in the collection that has a <span title="property names">property
- name</span> equal to <var title="">name</var>, then return that
- node and stop the algorithm.</li>
-
- <li>Otherwise, if there are no nodes in the collection that have a
- <span title="property names">property name</span> equal to <var
- title="">name</var>, then return null and stop the algorithm.</li>
-
- <li>Otherwise, create a <code>PropertyNodeList</code> object
- representing a live view of the <code>HTMLPropertyCollection</code>
- object, further filtered so that the only nodes in the
- <code>RadioNodeList</code> object are those that have a <span
- title="property names">property name</span> equal to <var
- title="">name</var>. The nodes in the <code>PropertyNodeList</code>
- object must be sorted in <span>tree order</span>.</li>
-
- <li>Return that <code>PropertyNodeList</code> object.</li>
-
- </ol>
-
<hr>
<p>A members of the <code>PropertyNodeList</code> interface
@@ -46188,7 +46176,8 @@
attribute returns an <code>HTMLPropertyCollection</code>, which can
be enumerated to go through each element that adds one or more
properties to the item. It can also be indexed by name, which will
- return the property with that name (if there is just one).</p>
+ return an object with a list of the elements that add properties
+ with that name.</p>
<p>Each element that adds a property also has a <code
title="dom-content">content</code> DOM attribute that returns its
@@ -46201,40 +46190,35 @@
"net.example.name" property from that item.</p>
<pre>var user = getItems('net.example.user')[0];
-alert('Hello ' + user.properties['net.example.name'].content + '!');</pre>
+alert('Hello ' + user.properties['net.example.name'][0].content + '!');</pre>
</div>
- <p>When an item has multiple properties with the same name, the
- <code>HTMLPropertyCollection</code> returns a
- <code>PropertyNodeList</code> object with all those properties
- instead of returning just one. The <code>PropertyNodeList</code>
- object can be used to obtained all the values at once using
- <em>its</em> <code
+ <p>The <code>HTMLPropertyCollection</code> object, when indexed by
+ name in this way, actually returns a <code>PropertyNodeList</code>
+ object with all the matching properties. The
+ <code>PropertyNodeList</code> object can be used to obtained all the
+ values at once using <em>its</em> <code
title="dom-PropertyNodeList-content">content</code> attribute, which
returns an array of all the values.</p>
<div class="example">
<p>In an earlier example, a "com.example.feline" item had two
- "com.example.color" values. This script looks up such items and
- then lists all their values. Because it doesn't know ahead of time
- if the item has zero, one, or more colors, it checks whether the
- value returned from the <code>HTMLPropertyCollection</code> is a
- <code>PropertyNodeList</code> (multiple colors), just a regular
- element (one color), or null (no colors) before using it.</p>
+ "com.example.color" values. This script looks up the first such
+ item and then lists all its values.</p>
<pre>var cat = getItems('com.example.feline')[0];
-var colors = cat.properties['com.example.color'];
+var colors = cat.properties['com.example.color'].content;
var result;
-if (!colors) {
+if (colors.length == 0) {
result = 'Color unknown.';
-} else if (colors instanceof PropertyNodeList) {
+} else if (colors.length == 1) {
+ result = 'Color: ' + colors[0];
+} else {
result = 'Colors:';
- for (var i = 0; i < colors.content.length; i += 1)
- result += ' ' + colors.content[i];
-} else {
- result = 'Color: ' + colors.content;
+ for (var i = 0; i < colors.length; i += 1)
+ result += ' ' + colors[i];
}</pre>
</div>
@@ -46551,12 +46535,16 @@
</dl>
+ <p>The <dfn>URL property elements</dfn> are the <code>a</code>,
+ <code>area</code>, <code>audio</code>, <code>embed</code>,
+ <code>iframe</code>, <code>img</code>, <code>link</code>,
+ <code>object</code>, <code>source</code>, and <code>video</code>
+ elements.</p>
+
<p>If a property's <span title="concept-property-value">value</span>
is an <span>absolute URL</span>, the property must be specified
- using an <code>a</code>, <code>area</code>, <code>audio</code>,
- <code>embed</code>, <code>iframe</code>, <code>img</code>,
- <code>link</code>, <code>object</code>, <code>source</code>, or
- <code>video</code> element.</p>
+ using an <span title="URL property elements">URL property
+ element</span>.</p>
@@ -46802,54 +46790,6 @@
</ul>
- <p>User agents must run the following steps to convert the <code
- title="md-vcard-fn">fn</code> property's <span
- title="concept-property-value">value</span> into an implied
- <code title="md-vcard-n-family-name">family-name</code>/<code
- title="md-vcard-n-given-name">given-name</code> pair:</p>
-
- <ol>
-
- <li><p>Let <var title="">value</var> be the <code
- title="md-vcard-fn">fn</code> property's <span
- title="concept-property-value">value</span>.</p></li>
-
- <li><p><span title="split a string on spaces">Split <var
- title="">value</var> on spaces</span>, and let <var
- title="">part one</var> be the first resulting token, and <var
- title="">part two</var> be the second.</p></li>
-
- <li><p>If the last character of <var title="">part one</var> is
- a U+002C COMMA character (,), then remove that character from
- <var title="">part one</var> and let the implied <code
- title="md-vcard-n-family-name">family-name</code> be <var
- title="">part one</var> and the implied <code
- title="md-vcard-n-given-name">given-name</code> be <var
- title="">part two</var>.</p></li>
-
- <li><p>Otherwise, if <var title="">part two</var> is two
- Unicode code-points long and its second character is a U+002E
- FULL STOP character (.), then let the implied <code
- title="md-vcard-n-family-name">family-name</code> be <var
- title="">part one</var> and the implied <code
- title="md-vcard-n-given-name">given-name</code> be the first
- character of <var title="">part two</var>.</p></li>
-
- <li><p>Otherwise, if <var title="">part two</var> is one
- Unicode code-point long, then let the implied <code
- title="md-vcard-n-family-name">family-name</code> be <var
- title="">part one</var> and the implied <code
- title="md-vcard-n-given-name">given-name</code> be <var
- title="">part two</var>.</p></li>
-
- <li><p>Otherwise, let the implied <code
- title="md-vcard-n-family-name">family-name</code> be <var
- title="">part two</var> and the implied <code
- title="md-vcard-n-given-name">given-name</code> be <var
- title="">part one</var>.</p></li>
-
- </ol>
-
</dd>
</dl>
@@ -48044,7 +47984,7 @@
(<span itemprop="organization-unit">Los Angeles Division</span>)
</p>
<p>
- <span class="adr" item>
+ <span itempror="adr" item>
<span itemprop="street-address">10201 W. Pico Blvd.</span><br>
<span itemprop="locality">Los Angeles</span>,
<span itemprop="region">CA</span>
@@ -48128,7 +48068,7 @@
<dl>
- <dt><dfn title="md-vcevent-attach"><code>attach</code></dfn></dt>
+ <dt><dfn title="md-vevent-attach"><code>attach</code></dfn></dt>
<dd>
@@ -48138,7 +48078,7 @@
an <span>absolute URL</span>.</p>
<p>Any number of properties with the name <code
- title="md-vcard-attach">attach</code> may be present within each
+ title="md-vevent-attach">attach</code> may be present within each
<span title="concept-item">item</span> with the type <code
title="md-vevent">vevent</code>.</p>
@@ -48787,9 +48727,8 @@
}
for (var nameIndex = 0; nameIndex < prop.itemprop.length; nameIndex += 1) {
var name = prop.itemprop[nameIndex];
- if (!name.match(':') && !name.match('.')) {
+ if (!name.match(':') && !name.match('.'))
calendar += name.toUpperCase() + parameters + ':' + value + '\r\n';
- }
}
}
calendar += 'END:VEVENT\r\nEND:VCALENDAR\r\n';
@@ -49710,7 +49649,11 @@
<h3>Converting HTML to other formats</h3>
+ <p>In all these algorithms, unless otherwise stated, operations that
+ iterate over a series of elements (whether items, properties, or
+ otherwise) must do so in <span>tree order</span>.</p>
+
<h4>JSON</h4>
<p>Given a node <var title="">node</var> in a <code>Document</code>,
@@ -50004,12 +49947,12 @@
title="concept-item-corresponding">corresponding item</span> is
<var title="">item</var>, exactly one has a <span title="property
names">property name</span> equal to the string "<code
- title="">about</code>", and the <span
- title="concept-property-value">property value</span> of that
- element is an <span>absolute URL</span>, let <var
- title="">subject</var> be that <span>absolute
- URL</span>. Otherwise, let <var title="">subject</var> be a new
- blank node.</p></li>
+ title="">about</code>", and that element is a <span title="URL
+ property elements">URL property element</span>, let <var
+ title="">subject</var> be the <span
+ title="concept-property-value">value</span> of that
+ property. Otherwise, let <var title="">subject</var> be a new blank
+ node.</p></li>
<li>
@@ -50064,14 +50007,11 @@
reserialise it, check if the <time> was valid, check if it had a
.date, a .time, a .timezone, etc. -->
- <li><p>Otherwise, if <var title="">element</var> is not an
- <code>a</code>, <code>area</code>, <code>audio</code>,
- <code>embed</code>, <code>iframe</code>, <code>img</code>,
- <code>link</code>, <code>object</code>, <code>source</code>, or
- <code>video</code> element, let <var title="">value</var> be a
- plain literal, with the language information set from the
- <span>language</span> of the element, if it is not
- unknown.</p></li>
+ <li><p>Otherwise, if <var title="">element</var> is not one of
+ the <span>URL property elements</span>, let <var
+ title="">value</var> be a plain literal, with the language
+ information set from the <span>language</span> of the element, if
+ it is not unknown.</p></li>
<li>
@@ -50117,9 +50057,737 @@
<h4>vCard</h4>
- <p class="XXX">...</p>
+ <p>Given a node <var title="">node</var> in a <code>Document</code>,
+ a user agent must run the following algorithm to <dfn
+ title="extracting a vCard">extract any <code
+ title="md-vcard">vcard</code> data represented by that
+ node</dfn>:</p>
+ <ol>
+ <li>
+
+ <p>If <var title="">node</var> is not an element that is an <span
+ title="concept-item">item</span> with the type <code
+ title="md-vcard">vcard</code>, then run these substeps:</p>
+
+ <ol>
+
+ <li><p>If <var title="">node</var> has no parent, then there is
+ no vCard. Abort the algorithm, returning nothing.</p></li>
+
+ <li><p>Let <var title="">node</var> be <var title="">node</var>'s
+ parent.</p></li>
+
+ <li><p>Restart the entire algorithm with the new value of <var
+ title="">node</var>.</p></li>
+
+ </ol>
+
+ </li>
+
+ <li><p>Let <var title="">output</var> be an empty string.</p></li>
+
+ <li><p><span>Add a vCard line</span> with the type "<code
+ title="">BEGIN</code>" and the value "<code title="">VCARD</code>"
+ to <var title="">output</var>.</p></li>
+
+ <li><p><span>Add a vCard line</span> with the type "<code
+ title="">PROFILE</code>" and the value "<code title="">VCARD</code>"
+ to <var title="">output</var>.</p></li>
+
+ <li><p><span>Add a vCard line</span> with the type "<code
+ title="">VERSION</code>" and the value "<code title="">3.0</code>"
+ to <var title="">output</var>.</p></li>
+
+ <li><p><span>Add a vCard line</span> with the type "<code
+ title="">SOURCE</code>" and <span>the document's current
+ address</span> as the value to <var title="">output</var>.</p></li>
+
+ <li><p>If <span>the <code>title</code> element</span> is not null,
+ <span>add a vCard line</span> with the type "<code
+ title="">NAME</code>" and the <code>textContent</code> of <span>the
+ <code>title</code> element</span> as the value to <var
+ title="">output</var>.</p></li>
+
+ <li>
+
+ <p>For each element <var title="">element</var> that has one or
+ more <span>property names</span> and whose <span
+ title="concept-item-corresponding">corresponding item</span> is
+ <var title="">node</var>: for each name <var title="">name</var>
+ in <var title="">element</var>'s <span>property names</span>, run
+ the following substeps:</p>
+
+ <ol>
+
+ <li><p>If <var title="">name</var> is equal to the string
+ "<code title="">about</code>", skip this name.</p></li>
+
+ <li><p>Let <var title="">parameters</var> be an empty set of
+ name-value pairs.</p></li>
+
+ <li>
+
+ <p>Run the appropriate set of substeps from the following
+ list. The steps will set a variable <var title="">value</var>,
+ which is used in the next step.</p>
+
+ <dl>
+
+ <dt>If the property's <span
+ title="concept-property-value">value</span> is an <span
+ title="concept-item">item</span> <var title="">subitem</var>
+ and <var title="">name</var> is <code
+ title="md-vcard-n">n</code></dt>
+
+ <dd>
+
+ <ol>
+
+ <li><p>Let <var title="">n1</var> be the <span
+ title="concept-property-value">value</span> of the first
+ property named <code
+ title="md-vcard-n-family-name">family-name</code> in <var
+ title="">subitem</var>, or the empty string if there is no
+ such property or the property's value is itself an <span
+ title="concept-item">item</span>.</p></li>
+
+ <li><p>Let <var title="">n2</var> be the <span
+ title="concept-property-value">value</span> of the first
+ property named <code
+ title="md-vcard-n-given-name">given-name</code> in <var
+ title="">subitem</var>, or the empty string if there is no
+ such property or the property's value is itself an <span
+ title="concept-item">item</span>.</p></li>
+
+ <li><p>Let <var title="">n3</var> be the <span
+ title="concept-property-value">value</span> of the first
+ property named <code
+ title="md-vcard-n-additional-name">additional-name</code> in
+ <var title="">subitem</var>, or the empty string if there is
+ no such property or the property's value is itself an <span
+ title="concept-item">item</span>.</p></li>
+
+ <li><p>Let <var title="">n4</var> be the <span
+ title="concept-property-value">value</span> of the first
+ property named <code
+ title="md-vcard-n-honorific-prefix">honorific-prefix</code>
+ in <var title="">subitem</var>, or the empty string if there
+ is no such property or the property's value is itself an
+ <span title="concept-item">item</span>.</p></li>
+
+ <li><p>Let <var title="">n5</var> be the <span
+ title="concept-property-value">value</span> of the first
+ property named <code
+ title="md-vcard-n-honorific-suffix">honorific-suffix</code>
+ in <var title="">subitem</var>, or the empty string if there
+ is no such property or the property's value is itself an
+ <span title="concept-item">item</span>.</p></li>
+
+ <li>
+
+ <p>Let <var title="">value</var> be the concatenation of the
+ following, in this order:</p>
+
+ <ol class="brief">
+ <li>The result of <span>escaping the vCard text string</span> <var title="">n1</var></li>
+ <li>A U+003B SEMICOLON character (;)</li>
+ <li>The result of <span>escaping the vCard text string</span> <var title="">n2</var></li>
+ <li>A U+003B SEMICOLON character (;)</li>
+ <li>The result of <span>escaping the vCard text string</span> <var title="">n3</var></li>
+ <li>A U+003B SEMICOLON character (;)</li>
+ <li>The result of <span>escaping the vCard text string</span> <var title="">n4</var></li>
+ <li>A U+003B SEMICOLON character (;)</li>
+ <li>The result of <span>escaping the vCard text string</span> <var title="">n5</var></li>
+ </ol>
+
+ </li>
+
+ </ol>
+
+ </dd>
+
+ <dt>If the property's <span
+ title="concept-property-value">value</span> is an <span
+ title="concept-item">item</span> <var title="">subitem</var>
+ and <var title="">name</var> is <code
+ title="md-vcard-adr">adr</code></dt>
+
+ <dd>
+
+ <ol>
+
+ <li><p>Let <var title="">value</var> be the empty
+ string.</p></li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <span>collecting vCard subproperties</span> named <code
+ title="md-vcard-adr-post-office-box">post-office-box</code>
+ in <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var
+ title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <span>collecting vCard subproperties</span> named <code
+ title="md-vcard-adr-extended-address">extended-address</code>
+ in <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var
+ title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <span>collecting vCard subproperties</span> named <code
+ title="md-vcard-adr-street-address">street-address</code> in
+ <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var
+ title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <span>collecting the first vCard subproperty</span> named
+ <code title="md-vcard-adr-locality">locality</code> in <var
+ title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var
+ title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <span>collecting the first vCard subproperty</span> named
+ <code title="md-vcard-adr-region">region</code> in <var
+ title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var
+ title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <span>collecting the first vCard subproperty</span> named
+ <code title="md-vcard-adr-postal-code">postal-code</code> in
+ <var title="">subitem</var>.</p>
+
+ <li>Append a U+003B SEMICOLON character (;) to <var
+ title="">value</var>.</li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <span>collecting the first vCard subproperty</span> named
+ <code title="md-vcard-adr-country-name">country-name</code>
+ in <var title="">subitem</var>.</p>
+
+ <li><p>If there is a property named <code
+ title="md-vcard-adr-type">type</code> in <var
+ title="">subitem</var>, and the first such property has a
+ <span title="concept-property-value">value</span> that is not
+ an <span title="concept-item">item</span> and whose value
+ consists only of <span>alphanumeric ASCII characters</span>,
+ then add a parameter named "<code title="">TYPE</code>" whose
+ value is the <span
+ title="concept-property-value">value</span> of that property
+ to <var title="">parameters</var>.</p></li>
+
+ </ol>
+
+ </dd>
+
+ <dt>If the property's <span
+ title="concept-property-value">value</span> is an <span
+ title="concept-item">item</span> <var title="">subitem</var>
+ and <var title="">name</var> is <code
+ title="md-vcard-org">org</code></dt>
+
+ <dd>
+
+ <ol>
+
+ <li><p>Let <var title="">value</var> be the empty
+ string.</p></li>
+
+ <li><p>Append to <var title="">value</var> the result of
+ <span>collecting the first vCard subproperty</span> named
+ <code
+ title="md-vcard-org-organization-name">organization-name</code>
+ in <var title="">subitem</var>.</p>
+
+ <li>
+
+ <p>For each property named <code
+ title="md-vcard-org-organization-unit">organization-unit</code>
+ in <var title="">subitem</var>, run the following steps:</p>
+
+ <ol>
+
+ <li><p>If the <span
+ title="concept-property-value">value</span> of the property
+ is an <span title="concept-item">item</span>, then skip
+ this property.</p></li>
+
+ <li><p>Append a U+003B SEMICOLON character (;) to <var
+ title="">value</var>.</p></li>
+
+ <li><p>Append the result of <span>escaping the vCard text
+ string</span> given by the <span
+ title="concept-property-value">value</span> of the property
+ to <var title="">value</var>.</p></li>
+
+ </ol>
+
+ </li>
+
+ </ol>
+
+ </dd>
+
+ <dt>If the property's <span
+ title="concept-property-value">value</span> is an <span
+ title="concept-item">item</span> <var title="">subitem</var>
+ with the type <code title="md-vcard">vcard</code> and <var
+ title="">name</var> is <code
+ title="md-vcard-agent">agent</code></dt>
+
+ <dd>
+
+ <ol>
+
+ <li><p>Let <var title="">value</var> be the result of
+ <span>escaping the vCard text string</span> obtained from
+ <span>extracting a vCard</span> from the element that
+ represents <var title="">subitem</var>.</p></li>
+
+ <li><p>Add a parameter named "<code title="">VALUE</code>"
+ whose value is "<code title="">VCARD</code>" to <var
+ title="">parameters</var>.</p></li>
+
+ </ol>
+
+ </dd>
+
+ <dt>If the property's <span
+ title="concept-property-value">value</span> is an <span
+ title="concept-item">item</span> and <var title="">name</var>
+ is none of the above</dt>
+
+ <dd>
+
+ <ol>
+
+ <li><p>Let <var title="">value</var> the result of
+ <span>collecting the first vCard subproperty</span> named
+ <code title="">value</code> in <var
+ title="">subitem</var>.</p>
+
+ <li><p>If there is a property named <code
+ title="">type</code> in <var title="">subitem</var>, and the
+ first such property has a <span
+ title="concept-property-value">value</span> that is not an
+ <span title="concept-item">item</span> and whose value
+ consists only of <span>alphanumeric ASCII characters</span>,
+ then add a parameter named "<code title="">TYPE</code>" whose
+ value is the <span
+ title="concept-property-value">value</span> of that property
+ to <var title="">parameters</var>.</p></li>
+
+ </ol>
+
+ </dd>
+
+ <dt>Otherwise (the property's <span
+ title="concept-property-value">value</span> is not an <span
+ title="concept-item">item</span>)</dt>
+
+ <dd>
+
+ <ol>
+
+ <li><p>Let <var title="">value</var> be the property's <span
+ title="concept-property-value">value</span>.</p></li>
+
+ <li><p>If <var title="">element</var> is one of the <span>URL
+ property elements</span>, add a parameter with the name "<code
+ title="">VALUE</code>" and the value "<code
+ title="">URI</code>" to <var
+ title="">parameters</var>.</p></li>
+
+ <li><p>Otherwise, if <var title="">element</var> is a
+ <code>time</code> element and the <var title="">value</var> is
+ a <span>valid date string</span>, add a parameter with the name
+ "<code title="">VALUE</code>" and the value "<code
+ title="">DATE</code>" to <var
+ title="">parameters</var>.</p></li>
+
+ <li><p>Otherwise, if <var title="">element</var> is a
+ <code>time</code> element and the <var title="">value</var> is
+ a <span>valid global date and time string</span>, add a
+ parameter with the name "<code title="">VALUE</code>" and the
+ value "<code title="">DATE-TIME</code>" to <var
+ title="">parameters</var>.</p></li>
+
+ <li><p>Prefix every U+005C REVERSE SOLIDUS character (\) in
+ <var title="">value</var> with another U+005C REVERSE SOLIDUS
+ character (\).</p></li>
+
+ <li><p>Prefix every U+002C COMMA character (,) in <var
+ title="">value</var> with a U+005C REVERSE SOLIDUS character
+ (\).</p></li>
+
+ <li><p>Unless <var title="">name</var> is <code
+ title="md-vcard-geo">geo</code>, prefix every U+003B SEMICOLON
+ character (;) in <var title="">value</var> with a U+005C
+ REVERSE SOLIDUS character (\).</p></li>
+
+ <li><p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED
+ character pair (CRLF) in <var title="">value</var> with a U+005C REVERSE
+ SOLIDUS character (\) followed by a U+006E LATIN SMALL LETTER
+ N.</p></li>
+
+ <li><p>Replace every remaining U+000D CARRIAGE RETURN (CR) or
+ U+000A LINE FEED (LF) character in <var title="">value</var>
+ with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E
+ LATIN SMALL LETTER N.</p></li>
+
+ </ol>
+
+ </dd>
+
+ </dl>
+
+ </li>
+
+ <li>
+
+ <p><span>Add a vCard line</span> with the type <var
+ title="">name</var>, the parameters <var
+ title="">parameters</var>, and the value <var
+ title="">value</var> to <var title="">output</var>.</p>
+
+ </li>
+
+ </ol>
+
+ </li>
+
+ <li>
+
+ <p>If there is no property named <code title="md-vcard-n">n</code>
+ whose <span title="concept-item-corresponding">corresponding
+ item</span> is <var title="">node</var>, then run the following
+ substeps:</p>
+
+ <ol>
+
+ <li><p>If there is no property named <code
+ title="md-vcard-fn">fn</code> whose <span
+ title="concept-item-corresponding">corresponding item</span> is
+ <var title="">node</var>, then skip the remainder of these
+ substeps.</p></li>
+
+ <li><p>If the first property named <code
+ title="md-vcard-fn">fn</code> whose <span
+ title="concept-item-corresponding">corresponding item</span> is
+ <var title="">node</var> has a <span
+ title="concept-property-value">value</span> that is an <span
+ title="concept-item">item</span>, then skip the remainder of
+ these substeps.</p></li>
+
+ <li><p>Let <var title="">fn</var> be the <span
+ title="concept-property-value">value</span> of the first property
+ named <code title="md-vcard-fn">fn</code> whose <span
+ title="concept-item-corresponding">corresponding item</span> is
+ <var title="">node</var>.</p></li>
+
+ <li><p>If there is a property named <code
+ title="md-vcard-org">org</code> whose <span
+ title="concept-item-corresponding">corresponding item</span> is
+ <var title="">node</var>, and the <span
+ title="concept-property-value">value</span> of the first such
+ property is equal to <var title="">fn</var> (and is not an <span
+ title="concept-item">item</span>), then <span>add a vCard
+ line</span> with the type "<code title="">N</code>" whose value
+ is four U+003B SEMICOLON characters ("<code
+ title="">;;;;</code>") to <var title="">output</var>. Then, skip
+ the remainder of these substeps.</p></li>
+
+ <li><p>If the <span title="space character">space
+ characters</span> in <var title="">fn</var>, if any, are not all
+ contiguous, then skip the remainder of these substeps.</p></li>
+
+ <li><p><span title="split a string on spaces">Split <var
+ title="">fn</var> on spaces</span>, and let <var title="">part
+ one</var> be the first resulting token, and <var title="">part
+ two</var> be the second, if any, or the empty string if there is
+ no second token. (There cannot be three, given the previous
+ step.)</p></li>
+
+ <li>
+
+ <p>If the last character of <var title="">part one</var> is a
+ U+002C COMMA character (,), then remove that character from <var
+ title="">part one</var> and <span>add a vCard line</span> with
+ the type "<code title="">N</code>" whose value is the
+ concatenation of the following strings:</p>
+
+ <ol class="brief">
+ <li>The result of <span>escaping the vCard text string</span> <var title="">part one</var></li>
+ <li>A U+003B SEMICOLON character (;)</li>
+ <li>The result of <span>escaping the vCard text string</span> <var title="">part two</var></li>
+ <li>Three U+003B SEMICOLON characters (;)</li>
+ </ol>
+
+ <p>Then, skip the remainder of these substeps.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">part two</var> is two Unicode code-points
+ long and its second character is a U+002E FULL STOP character
+ (.), then <span>add a vCard line</span> with the type "<code
+ title="">N</code>" whose value is the concatenation of the
+ following strings:</p>
+
+ <ol class="brief">
+ <li>The result of <span>escaping the vCard text string</span> <var title="">part one</var></li>
+ <li>A U+003B SEMICOLON character (;)</li>
+ <li>The result of <span>escaping the vCard text string</span> consisting of the first character of <var title="">part two</var></li>
+ <li>Three U+003B SEMICOLON characters (;)</li>
+ </ol>
+
+ <p>Then, skip the remainder of these substeps.</p>
+
+ </li>
+
+ <li>
+
+ <p>If <var title="">part two</var> is one Unicode code-point
+ long, then <span>add a vCard line</span> with the type "<code
+ title="">N</code>" whose value is the concatenation of the
+ following strings:</p>
+
+ <ol class="brief">
+ <li>The result of <span>escaping the vCard text string</span> <var title="">part one</var></li>
+ <li>A U+003B SEMICOLON character (;)</li>
+ <li>The result of <span>escaping the vCard text string</span> <var title="">part two</var></li>
+ <li>Three U+003B SEMICOLON characters (;)</li>
+ </ol>
+
+ <p>Then, skip the remainder of these substeps.</p>
+
+ </li>
+
+ <li>
+
+ <p><span>Add a vCard line</span> with the type "<code
+ title="">N</code>" whose value is the concatenation of the
+ following strings:</p>
+
+ <ol class="brief">
+ <li>The result of <span>escaping the vCard text string</span> <var title="">part two</var></li>
+ <li>A U+003B SEMICOLON character (;)</li>
+ <li>The result of <span>escaping the vCard text string</span> <var title="">part one</var></li>
+ <li>Three U+003B SEMICOLON characters (;)</li>
+ </ol>
+
+ </li>
+
+ </ol>
+
+ </li>
+
+ <li><p><span>Add a vCard line</span> with the type "<code
+ title="">END</code>" and the value "<code title="">VCARD</code>"
+ to <var title="">output</var>.</p></li>
+
+ </ol>
+
+ <p>When the above algorithm says that the user agent is to <dfn>add
+ a vCard line</dfn> consisting of a type <var title="">type</var>,
+ optionally some parameters, and a value <var title="">value</var> to
+ a string <var title="">output</var>, it must run the following
+ steps:</p>
+
+ <ol>
+
+ <li><p>Let <var title="">line</var> be an empty string.
+
+ <li><p>Append <var title="">type</var>, <span>converted to
+ uppercase</span>, to <var title="">line</var>.</p></li>
+
+ <li>
+
+ <p>If there are any parameters, then for each parameter, in the
+ order that they were added, run these substeps:</p>
+
+ <ol>
+
+ <li><p>Append a U+003B SEMICOLON character (;) to <var
+ title="">line</var>.</p></li>
+
+ <li><p>Append the parameter's name to <var
+ title="">line</var>.</p></li>
+
+ <li><p>Append a U+003D EQUALS SIGN character (=) to <var
+ title="">line</var>.</p></li>
+
+ <li><p>Append the parameter's value to <var
+ title="">line</var>.</p></li>
+
+ </ol>
+
+ </li>
+
+ <li><p>Append a U+003A COLON character (:) to <var
+ title="">line</var>.</p></li>
+
+ <li><p>Append <var title="">value</var> to <var
+ title="">line</var>.</p></li>
+
+ <li><p>Let <var title="">maximum length</var> be 75.</p></li>
+
+ <li>
+
+ <p>If and while <var title="">line</var> is longer than <var
+ title="">maximum length</var> Unicode code points long, run the
+ following substeps:</p>
+
+ <ol>
+
+ <li><p>Append the first <var title="">maximum length</var>
+ Unicode code points of <var title="">line</var> to <var
+ title="">output</var>.</p></li>
+
+ <li><p>Remove the first <var title="">maximum length</var>
+ Unicode code points from <var title="">line</var>.</p></li>
+
+ <li><p>Append a U+000D CARRIAGE RETURN character (CR) to <var
+ title="">output</var>.</p></li>
+
+ <li><p>Append a U+000A LINE FEED character (LF) to <var
+ title="">output</var>.</p></li>
+
+ <li><p>Append a U+0020 SPACE character to <var
+ title="">output</var>.</p></li>
+
+ <li><p>Let <var title="">maximum length</var> be 74.</p></li>
+
+ </ol>
+
+ </li>
+
+ <li><p>Append (what remains of) <var title="">line</var> to <var
+ title="">output</var>.</p></li>
+
+ <li><p>Append a U+000D CARRIAGE RETURN character (CR) to <var
+ title="">output</var>.</p></li>
+
+ <li><p>Append a U+000A LINE FEED character (LF) to <var
+ title="">output</var>.</p></li>
+
+ </ol>
+
+ <p>When the steps above require the user agent to obtain the result
+ of <dfn>collecting vCard subproperties</dfn> named <var
+ title="">subname</var> in <var title="">subitem</var>, the user
+ agent must run the following steps:</p>
+
+ <ol>
+
+ <li><p>Let <var title="">value</var> be the empty string.</p></li>
+
+ <li>
+
+ <p>For each property named <var title="">subname</var> in the item
+ <var title="">subitem</var>, run the following substeps:</p>
+
+ <ol>
+
+ <li><p>If the <span title="concept-property-value">value</span>
+ of the property is itself an <span
+ title="concept-item">item</span>, then skip this
+ property.</p></li>
+
+ <li><p>If this is not the first property named <var
+ title="">subname</var> in <var title="">subitem</var> (ignoring
+ any that were skipped by the previous step), then append a U+002C
+ COMMA character (,) to <var title="">value</var>.</p></li>
+
+ <li><p>Append the result of <span>escaping the vCard text
+ string</span> given by the <span
+ title="concept-property-value">value</span> of the property to
+ <var title="">value</var>.</p></li>
+
+ </ol>
+
+ </li>
+
+ <li><p>Return <var title="">value</var>.</p></li>
+
+ </ol>
+
+ <p>When the steps above require the user agent to obtain the result
+ of <dfn>collecting the first vCard subproperty</dfn> named <var
+ title="">subname</var> in <var title="">subitem</var>, the user
+ agent must run the following steps:</p>
+
+ <ol>
+
+ <li><p>If there are no properties named <var title="">subname</var>
+ in <var title="">subitem</var>, then abort these substeps,
+ returning the empty string.</p></li>
+
+ <li><p>If the <span title="concept-property-value">value</span> of
+ the first property named <var title="">subname</var> in <var
+ title="">subitem</var> is an <span
+ title="concept-item">item</span>, then abort these substeps,
+ returning the empty string.</p></li>
+
+ <li><p>Return the result of <span>escaping the vCard text
+ string</span> given by the <span
+ title="concept-property-value">value</span> of the first property
+ named <var title="">subname</var> in <var
+ title="">subitem</var>.</p></li>
+
+ </ol>
+
+ <p>When the above algorithms say the user agent is to <dfn
+ title="escaping the vCard text string">escape the vCard text
+ string</dfn> <var title="">value</var>, the user agent must use the
+ following steps:</p>
+
+ <ol>
+
+ <li><p>Prefix every U+005C REVERSE SOLIDUS character (\) in <var
+ title="">value</var> with another U+005C REVERSE SOLIDUS character
+ (\).</p></li>
+
+ <li><p>Prefix every U+002C COMMA character (,) in <var
+ title="">value</var> with a U+005C REVERSE SOLIDUS character
+ (\).</p></li>
+
+ <li><p>Prefix every U+003B SEMICOLON character (;) in <var
+ title="">value</var> with a U+005C REVERSE SOLIDUS character
+ (\).</p></li>
+
+ <li><p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED
+ character pair (CRLF) in <var title="">value</var> with a U+005C
+ REVERSE SOLIDUS character (\) followed by a U+006E LATIN SMALL
+ LETTER N.</p></li>
+
+ <li><p>Replace every remaining U+000D CARRIAGE RETURN (CR) or
+ U+000A LINE FEED (LF) character in <var title="">value</var> with a
+ U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN
+ SMALL LETTER N.</p></li>
+
+ <li><p>Return the mutated <var title="">value</var>.</p></li>
+
+ </ol>
+
+ <p class="note">This algorithm can generate invalid vCard output, if
+ the input does not conform to the rules described for the <code
+ title="md-vcard">vcard</code> <span>predefined type</span> and <span
+ title="predefined property name">predefined property
+ names</span>.</p> <!-- of course since vcard doesn't define error
+ handling, this is somewhat problematic. -->
+
+
<h4>iCalendar</h4>
<p class="XXX">...</p>
More information about the Commit-Watchers
mailing list