[html5] r3664 - [] (0) Add a variant on microdata that has only one type per item, and that can [...]
whatwg at whatwg.org
whatwg at whatwg.org
Mon Aug 24 00:38:55 PDT 2009
Author: ianh
Date: 2009-08-24 00:38:54 -0700 (Mon, 24 Aug 2009)
New Revision: 3664
Modified:
index
source
Log:
[] (0) Add a variant on microdata that has only one type per item, and that can thus allow words to be used as tokens for itemprops.
Modified: index
===================================================================
--- index 2009-08-23 09:02:19 UTC (rev 3663)
+++ index 2009-08-24 07:38:54 UTC (rev 3664)
@@ -71,7 +71,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-standard-—-23-august-2009>Draft Standard — 23 August 2009</h2>
+ <h2 class="no-num no-toc" id=draft-standard-—-24-august-2009>Draft Standard — 24 August 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>
<!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
Modified: source
===================================================================
--- source 2009-08-23 09:02:19 UTC (rev 3663)
+++ source 2009-08-24 07:38:54 UTC (rev 3664)
@@ -47873,6 +47873,929 @@
<!--END microdata1--><!--END html5-->
<!--START microdata2-->
+
+ <h4>The basic syntax</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>At a high level, microdata consists of a group of name-value
+ pairs. The groups are called <span
+ title="concept-item">items</span>, and each name-value pair is a
+ property. Items and properties are represented by regular
+ elements.</p>
+
+ <p>To create an item, the <code title="attr-item">item</code>
+ attribute is used.</p>
+
+ <p>To add a property to an item, the <code
+ title="attr-itemprop">itemprop</code> attribute is used on one of
+ the <span title="concept-item">item's</span> descendants.</p>
+
+ <div class="example">
+
+ <p>Here there are two items, each of which have the property "name":</p>
+
+ <pre><div item>
+ <p>My name is <span itemprop="name">Elizabeth</span>.</p>
+</div>
+
+<div item>
+ <p>My name is <span itemprop="name">Daniel</span>.</p>
+</div></pre>
+
+ </div>
+
+ <p>Properties generally have values that are strings.</p>
+
+ <div class="example">
+
+ <p>Here the item has three properties:</p>
+
+ <pre><div item>
+ <p>My name is <span itemprop="name">Neil</span>.</p>
+ <p>My band is called <span itemprop="band">Four Parts Water</span>.</p>
+ <p>I am <span itemprop="nationality">British</span>.</p>
+</div></pre>
+
+ </div>
+
+ <p>Properties can also have values that are <span
+ title="URL">URLs</span>. This is achieved using the <code>a</code>
+ element and its <code title="attr-hyperlink-href">href</code>
+ attribute, the <code>img</code> element and its <code
+ title="attr-img-src">src</code> attribute, or other elements that
+ link to or embed external resources.</p>
+
+ <div class="example">
+
+ <p>In this example, the item has one property, "image", whose value is a URL:</p>
+
+ <pre><div item>
+ <img itemprop="image" src="google-logo.png" alt="Google">
+</div></pre>
+
+ </div>
+
+ <p>Properties can also have values that are dates, times, or dates
+ and times. This is achieved using the <code>time</code> element and
+ its <code title="attr-time-datetime">datetime</code> attribute.</p>
+
+ <div class="example">
+
+ <p>In this example, the item has one property,
+ "birthday", whose value is a date:</p>
+
+ <pre><div item>
+ I was born on <time itemprop="birthday" datetime="2009-05-10">May 10th 2009</time>.
+</div></pre>
+
+ </div>
+
+ <p>Properties can also themselves be groups of name-value pairs, by
+ putting the <code title="attr-item">item</code> attribute on the
+ element that declares the property.</p>
+
+ <p>Items that are not part of others are called <span>top-level
+ microdata items</span>.</p>
+
+ <div class="example">
+
+ <p>In this example, the outer item represents a person, and the
+ inner one represents a band:</p>
+
+ <pre><div item>
+ <p>Name: <span itemprop="name">Amanda</span></p>
+ <p>Band: <span itemprop="band" item> <span itemprop="name">Jazz Band</span> (<span itemprop="size">12</span> players)</span></p>
+</div></pre>
+
+ <p>The outer item here has two properties, "name" and
+ "band". The "name" is "Amanda", and the
+ "band" is an item in its own right, with two
+ properties, "name" and "size". The
+ "name" of the band is "Jazz Band", and the
+ "size" is "12".</p>
+
+ <p>The outer item in this example is a top-level microdata
+ item.</p>
+
+ </div>
+
+ <p>Properties don't have to be given as descendants of the element
+ with the <code title="attr-item">item</code> attribute. They can be
+ associated with a specific <span title="concept-item">item</span>
+ using the <code title="attr-subject">subject</code> attribute, which
+ takes the ID of the element with the <code
+ title="attr-item">item</code> attribute.</p>
+
+ <div class="example">
+
+ <p>This example is the same as the previous one, but all the
+ properties are separated from their <span
+ title="concept-item">items</span>:</p>
+
+ <pre><div item id="amanda"></div>
+<p>Name: <span subject="amanda" itemprop="name">Amanda</span></p>
+<div subject="amanda" itemprop="band" item id="jazzband"></div>
+<p>Band: <span subject="jazzband" itemprop="name">Jazz Band</span></p>
+<p>Size: <span subject="jazzband" itemprop="size">12</span> players</p></pre>
+
+ <p>This gives the same result as the previous example. The first
+ item has two properties, "name", set to "Amanda", and "band", set
+ to another item. That second item has two further properties,
+ "name", set to "Jazz Band", and "size", set to "12".</p>
+
+ </div>
+
+ <p>An <span title="concept-item">item</span> can have multiple
+ properties with the same name and different values.</p>
+
+ <div class="example">
+
+ <p>This example describes an ice cream, with two flavors:</p>
+
+ <pre><div item>
+ <p>Flavors in my favorite ice cream:</p>
+ <ul>
+ <li itemprop="flavor">Lemon sorbet</li>
+ <li itemprop="flavor">Apricot sorbet</li>
+ </ul>
+</div></pre>
+
+ <p>This thus results in an item with two properties, both
+ "flavor", having the values "Lemon sorbet" and "Apricot
+ sorbet".</p>
+
+ </div>
+
+ <p>An element introducing a property can also introduce multiple
+ properties at once, to avoid duplication when some of the properties
+ have the same value.</p>
+
+ <div class="example">
+
+ <p>Here we see an item with two properties,
+ "favorite-color" and "favorite-fruit", both
+ set to the value "orange":</p>
+
+ <pre><div item>
+ <span itemprop="favorite-color favorite-fruit">orange</span>
+</div></pre>
+
+ </div>
+
+ <p>It's important to note that there is no relationship between the
+ microdata and the content of the document where the microdata is
+ marked up.</p>
+
+ <div class="example">
+
+ <p>There is no semantic difference, for instance, between the
+ following two examples:</p>
+
+ <pre><figure>
+ <img src="castle.jpeg">
+ <legend><span item><span itemprop="name">The Castle</span></span> (1986)</legend>
+</figure></pre>
+
+ <pre><span item><meta itemprop="name" content="The Castle"></span>
+<figure>
+ <img src="castle.jpeg">
+ <legend>The Castle (1986)</legend>
+</figure></pre>
+
+ <p>Both have a figure with a caption, and both, completely
+ unrelated to the figure, have an item with a name-value pair with
+ the name "name" and the value "The Castle". The only
+ difference is that if the user drags the caption out of the
+ document, in the former case, the item will be included in the
+ drag-and-drop data. In neither case is the image in any way
+ associated with the item.</p>
+
+ </div>
+
+
+ <h4>Typed items</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>The examples in the previous section show how information could
+ be marked up on a page that doesn't expect its microdata to be
+ re-used. Microdata is most useful, though, when it is used in
+ contexts where other authors and readers are able to cooperate to
+ make new uses of the markup.</p>
+
+ <p>For this purpose, it is necessary to give each <span
+ title="concept-item">item</span> a type, such as
+ "com.example.person", or "org.example.cat", or
+ "net.example.band". Types are identified in three ways:</p>
+
+ <ul class="brief">
+
+ <li>As <span title="URL">URLs</span>.
+
+ <li>As <span title="valid reversed DNS identifier">reversed DNS
+ labels</span>.
+
+ <li>Using the names of <span title="predefined type">predefined
+ types</span>, which are described below.
+
+ </ul>
+
+ <p><span title="URL">URLs</span> are self-explanatory. <span
+ title="valid reversed DNS identifier">Reversed DNS labels</span> are
+ strings such as "org.example.animals.cat" or "com.example.band".</p>
+
+ <p>The type for an <span title="concept-item">item</span> is given
+ as the value of the <code title="attr-item">item</code>
+ attribute.</p>
+
+ <div class="example">
+
+ <p>Here, the item is "org.example.animals.cat":</p>
+
+<pre><section item="org.example.animal.cat">
+ <h1 itemprop="name">Hedral</h1>
+ <p itemprop="desc">Hedral is a male american domestic
+ shorthair, with a fluffy black fur with white paws and belly.</p>
+ <img itemprop="img" src="hedral.jpeg" alt="" title="Hedral, age 18 months">
+</section></pre>
+
+ <p>In this example the "org.example.animals.cat" item has three
+ properties, a "name" ("Hedral"), a "desc" ("Hedral is..."), and an
+ "img" ("hedral.jpeg").</p>
+
+ </div>
+
+ <p>An item can only have one type. The type gives the context for
+ the properties: a property named "class" given for an item with the
+ type "com.example.census.person" might refer to the class of an
+ individual, while a property named "class" given for an item with
+ the type "com.example.school.teacher" might refer to the classroom a
+ teacher has been assigned.</p>
+
+
+
+ <h4>Selecting names when defining vocabularies</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>Using microdata means using a vocabulary. For some purposes, an
+ ad-hoc vocabulary is adequate. For others, a vocabulary will need to
+ be designed. Where possible, authors are encouraged to re-use
+ existing vocabularies, as this makes content re-use easier.</p>
+
+ <p>When designing new vocabularies, identifiers can be created
+ either using <span title="URL">URLs</span>, <span title="valid
+ reversed DNS identifier">reversed DNS labels</span>, or, for
+ properties, as plain words (with no dots or colons). For URLs
+ conflicts with other vocabularies can be avoided by only using
+ identifiers that correspond to pages that the author has control
+ over. Similarly, for reversed DNS labels conflicts can be avoided by
+ using a domain name that the author has control over, or by using
+ suffixes that correspond to the path components of pages that the
+ author has control over.</p>
+
+ <div class="example">
+
+ <p>For instance, if Jon and Adam both write content at <code
+ title="">example.com</code>, at <code
+ title="">http://example.com/jon/...</code> and <code
+ title="">http://example.com/adam/...</code> respectively, then they
+ could select identifiers of the form "com.example.jon.name" and
+ "com.example.adam.name" respectively.</p>
+
+ </div>
+
+ <p>Properties whose names are just plain words can only be used
+ within the context of the types for which they are intended;
+ properties named using URLs or reversed DNS labels can be reused in
+ items of any type. If an item has no type, and is not part of
+ another item, then if its properties have names that are just plain
+ words, they are not intended to be globally unique, and are instead
+ only intended for limited use. Generally speaking, authors are
+ encouraged to use either properties with globally unique names
+ (URLs, reversed DNS labels) or ensure that their items are
+ typed.</p>
+
+ <div class="example">
+
+ <p>Here, an item is an "org.example.animals.cat", and most of the
+ properties have names that are words defined in the context of that
+ type. There are also a few additional properties whose names come
+ from other vocabularies.</p>
+
+<pre><section item="org.example.animal.cat">
+ <h1 itemprop="name com.example.fn">Hedral</h1>
+ <p itemprop="desc">Hedral is a male american domestic
+ shorthair, with a fluffy <span
+ itemprop="com.example.color">black</span> fur with <span
+ itemprop="com.example.color">white</span> paws and belly.</p>
+ <img itemprop="img" src="hedral.jpeg" alt="" title="Hedral, age 18 months">
+</section></pre>
+
+ <p>This example has one item with two types and the following
+ properties:</p>
+
+ <table>
+ <thead>
+ <tr>
+ <td>Property
+ <td>Value
+ <tbody>
+ <tr>
+ <td>name
+ <td>Hedral
+ <tr>
+ <td>com.example.fn
+ <td>Hedral
+ <tr>
+ <td>desc
+ <td>Hedral is a male american domestic shorthair, with a fluffy black fur with white paws and belly.
+ <tr>
+ <td>com.example.color
+ <td>black
+ <tr>
+ <td>com.example.color
+ <td>white
+ <tr>
+ <td>img
+ <td>.../hedral.jpeg
+ </table>
+
+ </div>
+
+
+ <h4>Predefined vocabularies</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>To make the most common tasks simpler, certain vocabularies have
+ been predefined. These use short names for types and properties.</p>
+
+ <div class="example">
+
+ <p>For example, the <span title="md-vcard">vCard</span> vocabulary
+ can be used to mark up people's names:</p>
+
+ <pre><span item=vcard><span itemprop=fn>George Washington</span></span></pre>
+
+ <p>This creates a single item with a single name-value pair, with
+ the name "fn" and the value "George Washington". This is defined to
+ map to the following vCard:</p>
+
+ <pre>BEGIN:VCARD
+PROFILE:VCARD
+VERSION:3.0
+SOURCE:<var title="">document's address</var>
+FN:George Washington
+N:Washington;George;;;
+END:VCARD</pre>
+
+ </div>
+
+
+ <h4>Using the microdata DOM API</h4>
+
+ <p><i>This section is non-normative.</i></p>
+
+ <p>The microdata becomes even more useful when scripts can use it to
+ expose information to the user, for example offering it in a form
+ that can be used by other applications.</p>
+
+ <p>The <code title="dom-document-getItems">document.getItems(<var
+ title="">typeNames</var>)</code> method provides access to the
+ <span>top-level microdata items</span>. It returns a
+ <code>NodeList</code> containing the items with the specified types,
+ or all types if no argument is specified.</p>
+
+ <p>Each <span title="concept-item">item</span> is represented in the
+ DOM by the element on which the relevant <code
+ title="attr-item">item</code> attribute is found. The type of that
+ element can be obtained using the <code
+ title="dom-item">element.item</code> DOM attribute.</p>
+
+ <div class="example">
+
+ <p>This sample shows how the <code
+ title="dom-document-getItems">getItems()</code> method can be used
+ to obtain a list of all the top-level microdata items of one type
+ given in the document:</p>
+
+ <pre>var cats = document.getItems("com.example.feline");</pre>
+
+ </div>
+
+ <p>Once an element representing an <span
+ title="concept-item">item</span> has been obtained, its properties
+ can be extracted using the <code
+ title="dom-properties">properties</code> DOM attribute. This
+ 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 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
+ value.
+
+ <div class="example">
+
+ <p>This sample gets the first item of type "net.example.user" and
+ then pops up an alert using the "name" property from
+ that item.</p>
+
+ <pre>var user = document.getItems('net.example.user')[0];
+alert('Hello ' + user.properties['name'][0].content + '!');</pre>
+
+ </div>
+
+ <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-contents">contents</code> attribute,
+ which returns an array of all the values.</p>
+
+ <div class="example">
+
+ <p>In an earlier example, a "org.example.animals.cat" item had two
+ "com.example.color" values. This script looks up the first such
+ item and then lists all its values.</p>
+
+ <pre>var cat = document.getItems('org.example.animals.cat')[0];
+var colors = cat.properties['com.example.color'].contents;
+var result;
+if (colors.length == 0) {
+ result = 'Color unknown.';
+} else if (colors.length == 1) {
+ result = 'Color: ' + colors[0];
+} else {
+ result = 'Colors:';
+ for (var i = 0; i < colors.length; i += 1)
+ result += ' ' + colors[i];
+}</pre>
+
+ </div>
+
+ <p>It's also possible to get a list of all the <span>property
+ names</span> using the object's <code
+ title="dom-HTMLPropertyCollection-names">names</code> DOM
+ attribute.</p>
+
+ <div class="example">
+
+ <p>This example creates a big list with a nested list for each item
+ on the page, each with of all the property names used in that
+ item.</p>
+
+ <pre>var outer = document.createElement('ul');
+for (var item = 0; item < document.items.length; item += 1) {
+ var itemLi = document.createElement('li');
+ var inner = document.createElement('ul');
+ for (var name = 0; name < document.items[item].names.length; name += 1) {
+ var propLi = document.createElement('li');
+ propLi.appendChild(document.createTextNode(document.items[item].names[name]));
+ inner.appendChild(propLi);
+ }
+ itemLi.appendChild(inner);
+ outer.appendChild(itemLi);
+}
+document.body.appendChild(outer);</pre>
+
+ <p>If faced with the following from an earlier example:</p>
+
+ <pre><section item="org.example.animal.cat">
+ <h1 itemprop="name com.example.fn">Hedral</h1>
+ <p itemprop="desc">Hedral is a male american domestic
+ shorthair, with a fluffy <span
+ itemprop="com.example.color">black</span> fur with <span
+ itemprop="com.example.color">white</span> paws and belly.</p>
+ <img itemprop="img" src="hedral.jpeg" alt="" title="Hedral, age 18 months">
+</section></pre>
+
+ <p>...it would result in the following output:</p>
+
+ <ul>
+ <li>
+ <ul>
+ <li>name</li>
+ <li>com.example.fn</li>
+ <li>desc</li>
+ <li>com.example.color</li>
+ <li>img</li>
+ </ul>
+ </li>
+ </ul>
+
+ <p>(The duplicate occurrence of "com.example.color" is not included
+ in the list.)</p>
+
+ </div>
+
+
+
+ <h3>Encoding microdata</h3>
+
+ <h4>The microdata model</h4>
+
+ <p>The microdata model consists of groups of name-value pairs known
+ as <dfn title="concept-item">items</dfn>.</p>
+
+ <p>Each group has zero or more types, each name has one or more
+ values, and each value is either a string or another group of
+ name-value pairs.</p>
+
+
+ <h4>Items: the <dfn title="attr-item"><code>item</code></dfn> attribute</h4>
+
+ <p>Every <span title="HTML elements">HTML element</span> may have an
+ <code title="attr-item">item</code> attribute specified.</p>
+
+ <p>An element with the <code title="attr-item">item</code> attribute
+ specified creates a new <span title="concept-item">item</span>, a
+ group of name-value pairs.</p>
+
+ <p>The attribute, if specified, must have a value that is either:</p>
+
+ <ul>
+
+ <li>The empty string, or</li>
+
+ <li>A <span>valid URL</span> that is an <span>absolute URL</span>
+ for which the string "<code
+ title="">http://www.w3.org/1999/xhtml/custom#</code>" is not a
+ <span>prefix match</span>, or</li>
+
+ <li>A <span>valid reversed DNS identifier</span>, or</li>
+
+ <li>A <span>predefined type</span>.</li>
+
+ </ul>
+
+ <p>The <dfn>item type</dfn> of an element with an <code
+ title="attr-item">item</code> attribute is the value of the
+ element's <code title="attr-item">item</code> attribute. If the
+ attribute's value is the empty string, the element is said to have
+ no <span>item type</span>.</p>
+
+
+ <h4>Associating names with items</h4>
+
+ <p>The <dfn title="attr-subject"><code>subject</code></dfn>
+ attribute may be specified on any <span title="HTML elements">HTML
+ element</span> to associate the element with an element with an
+ <code title="attr-item">item</code> attribute. If the <code
+ title="attr-subject">subject</code> attribute is specified, the
+ attribute's value must be the ID of an element with an <code
+ title="attr-item">item</code> attribute, in the same
+ <code>Document</code> as the element with the <code
+ title="attr-subject">subject</code> attribute.</p>
+
+ <p>An element's <dfn
+ title="concept-item-corresponding">corresponding item</dfn> is
+ determined by its position in the DOM and by any <code
+ title="attr-subject">subject</code> attributes on the element, and
+ is defined as follows:</p>
+
+ <dl>
+
+ <dt>If the element has a <code title="attr-subject">subject</code>
+ attribute</dt>
+
+ <dd><p>If there is an element in the document with an ID equal to
+ the value of the <code title="attr-subject">subject</code>
+ attribute, and if the first such element has an <code
+ title="attr-item">item</code> attribute specified, then that
+ element is the <span
+ title="concept-item-corresponding">corresponding
+ item</span>. Otherwise, there is no <span
+ title="concept-item-corresponding">corresponding
+ item</span>.</p></dd>
+
+ <dt>If the element has no <code title="attr-subject">subject</code>
+ attribute but does have an ancestor with an <code
+ title="attr-item">item</code> attribute specified</dt>
+
+ <dd><p>The nearest ancestor element with the <code
+ title="attr-item">item</code> attribute specified is the element's
+ <span title="concept-item-corresponding">corresponding
+ item</span>.</p></dd>
+
+ <dt>If the element has neither <code
+ title="attr-subject">subject</code> attribute nor an ancestor with
+ an <code title="attr-item">item</code> attribute specified</dt>
+
+ <dd><p>The element has no <span
+ title="concept-item-corresponding">corresponding
+ item</span>.</p></dd>
+
+ </dl>
+
+ <p>The list of elements that create <span
+ title="concept-item">items</span> but do not themselves have a <span
+ title="concept-item-corresponding">corresponding item</span> forms
+ the list of <dfn>top-level microdata items</dfn>.</p>
+
+
+ <h4>Names: the <dfn title="attr-itemprop"><code>itemprop</code></dfn> attribute</h4>
+
+ <p>Every <span title="HTML elements">HTML element</span> that has a
+ <span title="concept-item-corresponding">corresponding item</span>
+ may have an <code title="attr-itemprop">itemprop</code> attribute
+ specified.</p>
+
+ <p>An element with the <code title="attr-itemprop">itemprop</code>
+ attribute specified adds one or more name-value pairs to its
+ <span title="concept-item-corresponding">corresponding item</span>.</p>
+
+ <p>The <code title="attr-itemprop">itemprop</code> attribute, if
+ specified, must have a value that is an <span>unordered set of
+ unique space-separated tokens</span> representing the names of the
+ name-value pairs that it adds. The attribute's value must have at
+ least one token.</p>
+
+ <p>Each token must be either:</p>
+
+ <ul>
+
+ <li>A <span>valid URL</span> that is an <span>absolute URL</span>
+ for which the string "<code
+ title="">http://www.w3.org/1999/xhtml/custom#</code>" is not a
+ <span>prefix match</span>, or</li>
+
+ <li>A <span>valid reversed DNS identifier</span>, or</li>
+
+ <li>A <span>predefined global property name</span> allowed in this
+ situation, or</li>
+
+ <li>If the item's <span>item type</span> is itself a
+ <span>predefined type</span>: a <span>predefined property
+ name</span> allowed in this situation, or</li>
+
+ <li>If the item's <span>item type</span> is not a <span>predefined
+ type</span>: a string that contains no U+002E FULL STOP (.) or
+ U+003A COLON (:) characters, and that is not a <span>predefined
+ global property name</span>.</li>
+
+ </ul>
+
+ <p>The <dfn>property names</dfn> of an element are the tokens that
+ the element's <code title="attr-itemprop">itemprop</code> attribute
+ is found to contain when its value is <span title="split a string on
+ spaces">split on spaces</span>, with the order preserved but with
+ duplicates removed (leaving only the first occurrence of each
+ name).</p>
+
+ <p>With an <span title="concept-item">item</span>, the properties
+ are unordered with respect to each other, except for properties with
+ the same name, which are ordered in <span>tree order</span>.</p>
+
+ <div class="example">
+
+ <p>In the following example, the "a" property has the values "1"
+ and "2", <em>in that order</em>, but whether the "a" property comes
+ before the "b" property or not is not important:</p>
+
+ <pre><div item>
+ <p itemprop="a">1</p>
+ <p itemprop="a">2</p>
+ <p itemprop="b">test</p>
+</div></pre>
+
+ <p>Thus, the following is equivalent:</p>
+
+ <pre><div item>
+ <p itemprop="b">test</p>
+ <p itemprop="a">1</p>
+ <p itemprop="a">2</p>
+</div></pre>
+
+ <p>As is the following:</p>
+
+ <pre><div item>
+ <p itemprop="a">1</p>
+ <p itemprop="b">test</p>
+ <p itemprop="a">2</p>
+</div></pre>
+
+ </div>
+
+
+ <h4>Values</h4>
+
+ <p>The <dfn title="concept-property-value">property value</dfn> of a
+ name-value pair added by an element with an <code
+ title="attr-itemprop">itemprop</code> attribute depends on the
+ element, as follows:</p>
+
+ <dl>
+
+ <dt>If the element also has an <code title="attr-item">item</code>
+ attribute</dt>
+
+ <dd><p>The value is the <span title="concept-item">item</span>
+ created by the element.</p></dd>
+
+
+ <dt>If the element is a <code>meta</code> element</dt>
+
+ <dd><p>The value is the value of the element's <code
+ title="attr-content">content</code> attribute, if any, or the empty
+ string if there is no such attribute.</p></dd>
+
+
+ <dt>If the element is an <code>audio</code>, <code>embed</code>,
+ <code>iframe</code>, <code>img</code>, <code>source</code>, or
+ <code>video</code> element</dt>
+
+ <dd><p>The value is the <span>absolute URL</span> that results from
+ <span title="resolve a url">resolving</span> the value of the
+ element's <code title="">src</code> attribute relative to the
+ element at the time the attribute is set, or the empty string if
+ there is no such attribute or if <span title="resolve a
+ url">resolving</span> it results in an error.</p></dd>
+
+
+ <dt>If the element is an <code>a</code>, <code>area</code>, or
+ <code>link</code> element</dt>
+
+ <dd><p>The value is the <span>absolute URL</span> that results from
+ <span title="resolve a url">resolving</span> the value of the
+ element's <code title="">href</code> attribute relative to the
+ element at the time the attribute is set, or the empty string if
+ there is no such attribute or if <span title="resolve a
+ url">resolving</span> it results in an error.</p></dd>
+
+
+ <dt>If the element is an <code>object</code> element</dt>
+
+ <dd><p>The value is the <span>absolute URL</span> that results from
+ <span title="resolve a url">resolving</span> the value of the
+ element's <code title="">data</code> attribute relative to the
+ element at the time the attribute is set, or the empty string if
+ there is no such attribute or if <span title="resolve a
+ url">resolving</span> it results in an error.</p></dd>
+
+
+ <dt>If the element is a <code>time</code> element with a <code
+ title="attr-datetime">datetime</code> attribute</dt>
+
+ <dd><p>The value is the value of the element's <code
+ title="attr-datetime">datetime</code> attribute.</p></dd>
+
+
+ <dt>Otherwise</dt>
+
+ <dd><p>The value is the element's
+ <code>textContent</code>.</p></dd>
+
+ </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 <span title="URL property elements">URL property
+ element</span>.</p>
+
+
+
+ <h3>Microdata DOM API</h3>
+
+ <dl class="domintro">
+
+ <dt><var title="">document</var> . <code title="dom-getItems()">getItems</code>( [ <var title="">types</var> ] )</dt>
+
+ <dd>
+
+ <p>Returns a <code>NodeList</code> of the elements in the <code>Document</code> that create <span title="concept-item">items</span>, that are not part of other <span title="concept-item">items</span>, and that are of one of the types given in the argument, if any are listed.</p>
+
+ <p>The <var title="">types</var> argument is interpreted as a space-separated list of types.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title="dom-properties">properties</code></dt>
+
+ <dd>
+
+ <p>If the element has an <code title="attr-item">item</code>
+ attribute, returns an <code>HTMLPropertyCollection</code> object
+ with all the element's properties. Otherwise, an empty
+ <code>HTMLPropertyCollection</code> object.</p>
+
+ </dd>
+
+ <dt><var title="">element</var> . <code title="dom-content">content</code> [ = <var title="">value</var> ]</dt>
+
+ <dd>
+
+ <p>Returns the element's <span
+ title="concept-property-value">value</span>.</p>
+
+ <p>Can be set, to change the element's <span
+ title="concept-property-value">value</span>.</p>
+
+ </dd>
+
+ </dl>
+
+ <div class="impl">
+
+ <p>The <dfn
+ title="dom-document-getItems"><code>document.getItems(<var
+ title="">typeNames</var>)</code></dfn> method takes an optional
+ string that contains an <span>unordered set of unique
+ space-separated tokens</span> representing types. When called, the
+ method must return a live <code>NodeList</code> object containing
+ all the elements in the document, in <span>tree order</span>, that
+ are <span>top-level microdata items</span> whose <span title="item
+ types">types</span> are one of the types specified in that argument,
+ having obtained the types by <span title="split a string on
+ spaces">splitting the string on spaces</span>. If there are no
+ tokens specified in the argument, or if the argument is missing,
+ then the method must return a <code>NodeList</code> containing all
+ the <span>top-level microdata items</span> in the document.</p>
+
+ <p>The <dfn title="dom-item"><code>item</code></dfn> DOM attribute
+ on elements must <span>reflect</span> the element's <code
+ title="attr-item">item</code> content attribute.</p>
+
+ <p>The <dfn title="dom-itemprop"><code>itemprop</code></dfn> DOM
+ attribute on elements must <span>reflect</span> the element's <code
+ title="attr-itemprop">itemprop</code> content attribute.</p>
+
+ <p>The <dfn title="dom-properties"><code>properties</code></dfn> DOM
+ attribute on elements must return an
+ <code>HTMLPropertyCollection</code> rooted at the
+ <code>Document</code> node, whose filter matches only elements that
+ have <span>property names</span> and have a <span
+ title="concept-item-corresponding">corresponding item</span> that is
+ equal to the element on which the attribute was invoked.</p>
+
+ <p>The <dfn title="dom-content"><code>content</code></dfn> DOM
+ attribute's behavior depends on the element, as follows:</p>
+
+ <dl>
+
+ <dt>If the element is a <code>meta</code> element</dt>
+
+ <dd><p>The attribute must act as it would if it was <span
+ title="reflect">reflecting</span> the element's <code
+ title="attr-meta-content">content</code> content
+ attribute.</p></dd>
+
+
+ <dt>If the element is an <code>audio</code>, <code>embed</code>,
+ <code>iframe</code>, <code>img</code>, <code>source</code>, or
+ <code>video</code> element</dt>
+
+ <dd><p>The attribute must act as it would if it was <span
+ title="reflect">reflecting</span> the element's <code
+ title="">src</code> content attribute.</p></dd>
+
+
+ <dt>If the element is an <code>a</code>, <code>area</code>, or
+ <code>link</code> element</dt>
+
+ <dd><p>The attribute must act as it would if it was <span
+ title="reflect">reflecting</span> the element's <code
+ title="">href</code> content attribute.</p></dd>
+
+
+ <dt>If the element is an <code>object</code> element</dt>
+
+ <dd><p>The attribute must act as it would if it was <span
+ title="reflect">reflecting</span> the element's <code
+ title="">data</code> content attribute.</p></dd>
+
+
+ <dt>If the element is a <code>time</code> element with a <code
+ title="attr-datetime">datetime</code> attribute</dt>
+
+ <dd><p>The attribute must act as it would if it was <span
+ title="reflect">reflecting</span> the element's <code
+ title="">datetime</code> content attribute.</p></dd>
+
+
+ <dt>Otherwise</dt>
+
+ <dd><p>The attribute must act the same as the element's
+ <code>textContent</code> attribute.</p></dd>
+
+ </dl>
+
+ <p>The <dfn title="dom-subject"><code>subject</code></dfn> DOM
+ attribute on elements must <span>reflect</span> the element's <code
+ title="attr-subject">subject</code> content attribute.</p>
+
+ </div>
+
<!--END microdata2-->
<!--START microdata3-->
<!--END microdata3-->
More information about the Commit-Watchers
mailing list