Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[giow] (0) Microdata: Rename .content to .itemValue and make it more …
…useful.

git-svn-id: http://svn.whatwg.org/webapps@4140 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Oct 14, 2009
1 parent 01c0d23 commit 50b0643
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 59 deletions.
63 changes: 43 additions & 20 deletions complete.html
Expand Up @@ -6166,7 +6166,7 @@ <h5 id=htmlpropertycollection-0><span class=secno>2.7.2.5 </span>HTMLPropertyCol
typedef sequence&lt;any&gt; <dfn id=propertyvaluearray>PropertyValueArray</dfn>;

interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <span>NodeList</span> {
readonly attribute <a href=#propertyvaluearray>PropertyValueArray</a> <a href=#dom-propertynodelist-contents title=dom-PropertyNodeList-contents>contents</a>;
readonly attribute <a href=#propertyvaluearray>PropertyValueArray</a> <a href=#dom-propertynodelist-values title=dom-PropertyNodeList-values>values</a>;
};</pre>

<dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLPropertyCollection-length><a href=#dom-htmlpropertycollection-length>length</a></code></dt>
Expand Down Expand Up @@ -6194,7 +6194,7 @@ <h5 id=htmlpropertycollection-0><span class=secno>2.7.2.5 </span>HTMLPropertyCol
<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> . <code title=dom-PropertyNodeList-contents><a href=#dom-propertynodelist-contents>contents</a></code></dt>
<dt><var title="">propertyNodeList</var> . <code title=dom-PropertyNodeList-values><a href=#dom-propertynodelist-values>values</a></code></dt>
<dd>
<p>Returns an array of the various values that the relevant elements have.</p>
</dd>
Expand Down Expand Up @@ -6240,12 +6240,11 @@ <h5 id=htmlpropertycollection-0><span class=secno>2.7.2.5 </span>HTMLPropertyCol
from the <code>NodeList</code> interface must behave as they would
on a <code>NodeList</code> object.</p>

<p>The <dfn id=dom-propertynodelist-contents title=dom-PropertyNodeList-contents><code>contents</code></dfn>
<p>The <dfn id=dom-propertynodelist-values title=dom-PropertyNodeList-values><code>values</code></dfn>
IDL attribute on the <code><a href=#propertynodelist>PropertyNodeList</a></code> object, on
getting, must return a newly constructed array 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>
values obtained from the <code title=dom-itemValue><a href=#dom-itemvalue>itemValue</a></code> DOM property of each of the
elements represented by the object, in <a href=#tree-order>tree order</a>.</p>

</div>

Expand Down Expand Up @@ -7726,7 +7725,7 @@ <h4 id=elements-in-the-dom><span class=secno>3.2.2 </span>Elements in the DOM</h
attribute DOMString <a href=#dom-itemid title=dom-itemId>itemId</a>;
[PutForwards=<a href=#dom-domsettabletokenlist-value title=dom-DOMSettableTokenList-value>value</a>] readonly attribute <a href=#domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-itemprop title=dom-itemProp>itemProp</a>;
readonly attribute <a href=#htmlpropertycollection>HTMLPropertyCollection</a> <a href=#dom-properties title=dom-properties>properties</a>;
attribute DOMString <a href=#dom-content title=dom-content>content</a>;
attribute any <a href=#dom-itemvalue title=dom-itemValue>itemValue</a>;

// <a href=#editing>user interaction</a>
attribute boolean <a href=#dom-hidden title=dom-hidden>hidden</a>;
Expand Down Expand Up @@ -11080,6 +11079,7 @@ <h4 id=meta><span class=secno>4.2.5 </span>The <dfn><code>meta</code></dfn> elem
<pre class=idl>interface <dfn id=htmlmetaelement>HTMLMetaElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
attribute DOMString <a href=#dom-meta-name title=dom-meta-name>name</a>;
attribute DOMString <a href=#dom-meta-httpequiv title=dom-meta-httpEquiv>httpEquiv</a>;
attribute DOMString <a href=#dom-meta-content title=dom-meta-content>content</a>;
};</pre>
</dd>
</dl><p>The <code><a href=#meta>meta</a></code> element <a href=#represents>represents</a> various
Expand Down Expand Up @@ -11138,8 +11138,8 @@ <h4 id=meta><span class=secno>4.2.5 </span>The <dfn><code>meta</code></dfn> elem

<div class=impl>

<p>The <dfn id=dom-meta-name title=dom-meta-name><code>name</code></dfn> IDL
attribute must <a href=#reflect>reflect</a> the content attribute of the
<p>The <dfn id=dom-meta-name title=dom-meta-name><code>name</code></dfn> and <dfn id=dom-meta-content title=dom-meta-content><code>content</code></dfn> IDL attributes
must <a href=#reflect>reflect</a> the respective content attributes of the
same name. The IDL attribute <dfn id=dom-meta-httpequiv title=dom-meta-httpEquiv><code>httpEquiv</code></dfn> must
<a href=#reflect>reflect</a> the content attribute <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code>.</p>

Expand Down Expand Up @@ -44453,8 +44453,8 @@ <h4 id=using-the-microdata-dom-api><span class=secno>5.1.6 </span>Using the micr
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> IDL attribute that returns its
value.
<p>Each element that adds a property also has a <code title=dom-itemValue><a href=#dom-itemvalue>itemValue</a></code> IDL attribute that returns
its value.</p>

<div class=example>

Expand All @@ -44471,8 +44471,8 @@ <h4 id=using-the-microdata-dom-api><span class=secno>5.1.6 </span>Using the micr
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-contents><a href=#dom-propertynodelist-contents>contents</a></code> attribute,
which returns an array of all the values.</p>
values at once using <em>its</em> <code title=dom-PropertyNodeList-values><a href=#dom-propertynodelist-values>values</a></code> attribute, which
returns an array of all the values.</p>

<div class=example>

Expand All @@ -44481,7 +44481,7 @@ <h4 id=using-the-microdata-dom-api><span class=secno>5.1.6 </span>Using the micr
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 colors = cat.properties['com.example.color'].values;
var result;
if (colors.length == 0) {
result = 'Color unknown.';
Expand Down Expand Up @@ -44910,13 +44910,16 @@ <h3 id=microdata-dom-api><span class=secno>5.3 </span>Microdata DOM API</h3>

</dd>

<dt><var title="">element</var> . <code title=dom-content><a href=#dom-content>content</a></code> [ = <var title="">value</var> ]</dt>
<dt><var title="">element</var> . <code title=dom-itemValue><a href=#dom-itemvalue>itemValue</a></code> [ = <var title="">value</var> ]</dt>

<dd>

<p>Returns the element's <a href=#concept-property-value title=concept-property-value>value</a>.</p>

<p>Can be set, to change the element's <a href=#concept-property-value title=concept-property-value>value</a>.</p>
<p>Can be set, to change the element's <a href=#concept-property-value title=concept-property-value>value</a>. Setting the <a href=#concept-property-value title=concept-property-value>value</a> when the element has
no <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute or when
the element's value is an <a href=#concept-item title=concept-item>item</a>
throws an <code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code> exception.</p>

</dd>

Expand Down Expand Up @@ -44948,10 +44951,23 @@ <h3 id=microdata-dom-api><span class=secno>5.3 </span>Microdata DOM API</h3>
on which the attribute was invoked, while that element is an <a href=#concept-item title=concept-item>item</a>, and matches nothing the rest of
the time.</p>

<p>The <dfn id=dom-content title=dom-content><code>content</code></dfn> IDL
<p>The <dfn id=dom-itemvalue title=dom-itemValue><code>itemValue</code></dfn> IDL
attribute's behavior depends on the element, as follows:</p>

<dl><dt>If the element is a <code><a href=#meta>meta</a></code> element</dt>
<dl><dt>If the element has no <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute</dt>

<dd><p>The attribute must return null on getting and must throw an
<code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code> exception on setting.</p>


<dt>If the element has an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute</dt>

<dd><p>The attribute must return the element itself on getting and
must throw an <code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code> exception on
setting.</p>


<dt>If the element is a <code><a href=#meta>meta</a></code> element</dt>

<dd><p>The attribute must act as it would if it was <a href=#reflect title=reflect>reflecting</a> the element's <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> content
attribute.</dd>
Expand Down Expand Up @@ -44985,7 +45001,14 @@ <h3 id=microdata-dom-api><span class=secno>5.3 </span>Microdata DOM API</h3>
<dd><p>The attribute must act the same as the element's
<code>textContent</code> attribute.</dd>

</dl></div>
</dl><p>When the <code title=dom-itemValue><a href=#dom-itemvalue>itemValue</a></code> IDL
attribute is <a href=#reflect title=reflect>reflecting</a> a content
attribute or acting like the element's <code>textContent</code>
attribute, the user agent must, on setting, convert the new value to
the IDL <code title="">DOMString</code> value before using it
according to the mappings described above.</p>

</div>



Expand Down Expand Up @@ -47498,7 +47521,7 @@ <h5 id=examples-2><span class=secno>5.4.2.2 </span>Examples</h5>
calendar += 'UID:' + node.itemId + '\r\n';
for (var propIndex = 0; propIndex &lt; node.properties.length; propIndex += 1) {
var prop = node.properties[propIndex];
var value = prop.contents;
var value = prop.itemValue;
var parameters = '';
if (prop.localName == 'time') {
value = value.replace(/[:-]/g, '');
Expand Down
61 changes: 42 additions & 19 deletions index
Expand Up @@ -5995,7 +5995,7 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E..
typedef sequence&lt;any&gt; <dfn id=propertyvaluearray>PropertyValueArray</dfn>;

interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <span>NodeList</span> {
readonly attribute <a href=#propertyvaluearray>PropertyValueArray</a> <a href=#dom-propertynodelist-contents title=dom-PropertyNodeList-contents>contents</a>;
readonly attribute <a href=#propertyvaluearray>PropertyValueArray</a> <a href=#dom-propertynodelist-values title=dom-PropertyNodeList-values>values</a>;
};</pre>

<dl class=domintro><dt><var title="">collection</var> . <code title=dom-HTMLPropertyCollection-length><a href=#dom-htmlpropertycollection-length>length</a></code></dt>
Expand Down Expand Up @@ -6023,7 +6023,7 @@ interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <span>NodeList</span
<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> . <code title=dom-PropertyNodeList-contents><a href=#dom-propertynodelist-contents>contents</a></code></dt>
<dt><var title="">propertyNodeList</var> . <code title=dom-PropertyNodeList-values><a href=#dom-propertynodelist-values>values</a></code></dt>
<dd>
<p>Returns an array of the various values that the relevant elements have.</p>
</dd>
Expand Down Expand Up @@ -6069,12 +6069,11 @@ interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <span>NodeList</span
from the <code>NodeList</code> interface must behave as they would
on a <code>NodeList</code> object.</p>

<p>The <dfn id=dom-propertynodelist-contents title=dom-PropertyNodeList-contents><code>contents</code></dfn>
<p>The <dfn id=dom-propertynodelist-values title=dom-PropertyNodeList-values><code>values</code></dfn>
IDL attribute on the <code><a href=#propertynodelist>PropertyNodeList</a></code> object, on
getting, must return a newly constructed array 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>
values obtained from the <code title=dom-itemValue><a href=#dom-itemvalue>itemValue</a></code> DOM property of each of the
elements represented by the object, in <a href=#tree-order>tree order</a>.</p>

</div>

Expand Down Expand Up @@ -7555,7 +7554,7 @@ interface <dfn id=htmldocument>HTMLDocument</dfn> {
attribute DOMString <a href=#dom-itemid title=dom-itemId>itemId</a>;
[PutForwards=<a href=#dom-domsettabletokenlist-value title=dom-DOMSettableTokenList-value>value</a>] readonly attribute <a href=#domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-itemprop title=dom-itemProp>itemProp</a>;
readonly attribute <a href=#htmlpropertycollection>HTMLPropertyCollection</a> <a href=#dom-properties title=dom-properties>properties</a>;
attribute DOMString <a href=#dom-content title=dom-content>content</a>;
attribute any <a href=#dom-itemvalue title=dom-itemValue>itemValue</a>;

// <a href=#editing>user interaction</a>
attribute boolean <a href=#dom-hidden title=dom-hidden>hidden</a>;
Expand Down Expand Up @@ -10909,6 +10908,7 @@ gave me some of the songs they wrote. I love sharing my music.&lt;/p&gt;
<pre class=idl>interface <dfn id=htmlmetaelement>HTMLMetaElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
attribute DOMString <a href=#dom-meta-name title=dom-meta-name>name</a>;
attribute DOMString <a href=#dom-meta-httpequiv title=dom-meta-httpEquiv>httpEquiv</a>;
attribute DOMString <a href=#dom-meta-content title=dom-meta-content>content</a>;
};</pre>
</dd>
</dl><p>The <code><a href=#meta>meta</a></code> element <a href=#represents>represents</a> various
Expand Down Expand Up @@ -10967,8 +10967,8 @@ gave me some of the songs they wrote. I love sharing my music.&lt;/p&gt;

<div class=impl>

<p>The <dfn id=dom-meta-name title=dom-meta-name><code>name</code></dfn> IDL
attribute must <a href=#reflect>reflect</a> the content attribute of the
<p>The <dfn id=dom-meta-name title=dom-meta-name><code>name</code></dfn> and <dfn id=dom-meta-content title=dom-meta-content><code>content</code></dfn> IDL attributes
must <a href=#reflect>reflect</a> the respective content attributes of the
same name. The IDL attribute <dfn id=dom-meta-httpequiv title=dom-meta-httpEquiv><code>httpEquiv</code></dfn> must
<a href=#reflect>reflect</a> the content attribute <code title=attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code>.</p>

Expand Down Expand Up @@ -44282,8 +44282,8 @@ contradict people?
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> IDL attribute that returns its
value.
<p>Each element that adds a property also has a <code title=dom-itemValue><a href=#dom-itemvalue>itemValue</a></code> IDL attribute that returns
its value.</p>

<div class=example>

Expand All @@ -44300,8 +44300,8 @@ alert('Hello ' + user.properties['name'][0].content + '!');</pre>
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-contents><a href=#dom-propertynodelist-contents>contents</a></code> attribute,
which returns an array of all the values.</p>
values at once using <em>its</em> <code title=dom-PropertyNodeList-values><a href=#dom-propertynodelist-values>values</a></code> attribute, which
returns an array of all the values.</p>

<div class=example>

Expand All @@ -44310,7 +44310,7 @@ alert('Hello ' + user.properties['name'][0].content + '!');</pre>
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 colors = cat.properties['com.example.color'].values;
var result;
if (colors.length == 0) {
result = 'Color unknown.';
Expand Down Expand Up @@ -44739,13 +44739,16 @@ document.body.appendChild(outer);</pre>

</dd>

<dt><var title="">element</var> . <code title=dom-content><a href=#dom-content>content</a></code> [ = <var title="">value</var> ]</dt>
<dt><var title="">element</var> . <code title=dom-itemValue><a href=#dom-itemvalue>itemValue</a></code> [ = <var title="">value</var> ]</dt>

<dd>

<p>Returns the element's <a href=#concept-property-value title=concept-property-value>value</a>.</p>

<p>Can be set, to change the element's <a href=#concept-property-value title=concept-property-value>value</a>.</p>
<p>Can be set, to change the element's <a href=#concept-property-value title=concept-property-value>value</a>. Setting the <a href=#concept-property-value title=concept-property-value>value</a> when the element has
no <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute or when
the element's value is an <a href=#concept-item title=concept-item>item</a>
throws an <code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code> exception.</p>

</dd>

Expand Down Expand Up @@ -44777,10 +44780,23 @@ document.body.appendChild(outer);</pre>
on which the attribute was invoked, while that element is an <a href=#concept-item title=concept-item>item</a>, and matches nothing the rest of
the time.</p>

<p>The <dfn id=dom-content title=dom-content><code>content</code></dfn> IDL
<p>The <dfn id=dom-itemvalue title=dom-itemValue><code>itemValue</code></dfn> IDL
attribute's behavior depends on the element, as follows:</p>

<dl><dt>If the element is a <code><a href=#meta>meta</a></code> element</dt>
<dl><dt>If the element has no <code title=attr-itemprop><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute</dt>

<dd><p>The attribute must return null on getting and must throw an
<code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code> exception on setting.</p>


<dt>If the element has an <code title=attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute</dt>

<dd><p>The attribute must return the element itself on getting and
must throw an <code><a href=#invalid_access_err>INVALID_ACCESS_ERR</a></code> exception on
setting.</p>


<dt>If the element is a <code><a href=#meta>meta</a></code> element</dt>

<dd><p>The attribute must act as it would if it was <a href=#reflect title=reflect>reflecting</a> the element's <code title=attr-meta-content><a href=#attr-meta-content>content</a></code> content
attribute.</dd>
Expand Down Expand Up @@ -44814,7 +44830,14 @@ document.body.appendChild(outer);</pre>
<dd><p>The attribute must act the same as the element's
<code>textContent</code> attribute.</dd>

</dl></div>
</dl><p>When the <code title=dom-itemValue><a href=#dom-itemvalue>itemValue</a></code> IDL
attribute is <a href=#reflect title=reflect>reflecting</a> a content
attribute or acting like the element's <code>textContent</code>
attribute, the user agent must, on setting, convert the new value to
the IDL <code title="">DOMString</code> value before using it
according to the mappings described above.</p>

</div>



Expand Down

0 comments on commit 50b0643

Please sign in to comment.