Skip to content
This repository has been archived by the owner on Nov 11, 2019. It is now read-only.

Commit

Permalink
match algorithm for finding values to reality
Browse files Browse the repository at this point in the history
see #20, #38, #39

Note that if there is a `content` attribute is is selected **in
preference** to another specific attribute, including `src` and `href`
  • Loading branch information
chaals committed May 19, 2017
1 parent e462028 commit 87aad02
Showing 1 changed file with 56 additions and 43 deletions.
99 changes: 56 additions & 43 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,20 @@
</section>

<section id="sotd">
<p>This document is an editor's draft for the <a href="https://www.w3.org/WebPlatform/WG/">Web Platform Working Group</a>, proposed as an update to the <a href="https://www.w3.org/TR/2017/WD-microdata-20170504/">4 May 2017 W3C First Public Working Draft</a>.</p>
<p>This document is an editor's draft for the <a href="https://www.w3.org/WebPlatform/WG/">Web Platform Working Group</a>,
proposed as an update to the
<a href="https://www.w3.org/TR/2017/WD-microdata-20170504/">4 May 2017 W3C First Public Working Draft</a>.</p>

<p>This specification is an extension to HTML. All normative content in the HTML specification, unless specifically overridden by this specification, is intended to be the basis for this specification. [[!HTML52]]</p>
<p>This specification is an extension to HTML.
All normative content in the HTML specification not specifically overridden by this specification
is intended to be normative for this specification. [[!HTML52]]</p>

<!-- where to send feedback (required) -->
<p>If you wish to make comments regarding this document please
<a href="https://github.com/w3c/microdata">submit them as github issues</a>. All feedback is welcome, but please note the <a href="https://github.com/w3c/microdata/blob/master/CONTRIBUTING.md">contribution guidelines</a> require agreement to the terms of the W3C Patent Policy for substantive contributions.</p>
<a href="https://github.com/w3c/microdata">submit them as github issues</a>.
All feedback is welcome, but please note the
<a href="https://github.com/w3c/microdata/blob/master/CONTRIBUTING.md">contribution guidelines</a>
require agreement to the terms of the W3C Patent Policy for substantive contributions.</p>
</section>

<!--YYY-->
Expand All @@ -100,19 +107,22 @@ <h2>Terminology</h2>
<p>For the purposes of this specification, the terms "URL" and "URI" are equivalent.
The URL specification, and RFC 3986 which uses the term URI, define a <dfn data-lt="url|uri">URL</dfn>,
<dfn>valid URL</dfn>, and <dfn>absolute URL</dfn>. [[RFC3986]][[URL]]<p>
<p>A <dfn>valid absolute URL</dfn> is an <a>absolute URL</a> which is <a data-lt="valid URL">valid</a>.
To <dfn>resolve a URL</dfn> means to convert it to its <a data-lt="absolute URL">absolute form</a>,
taking into account the address of the document in which it is found.<!-- and base elements, or not? --></p>
<p>A <dfn>valid absolute URL</dfn> is an <a>absolute URL</a> which is <a data-lt="valid URL">valid</a>.</p>

<p>DOM 4.1 defines <dfn id="tree-order">tree order</dfn>. [[!DOM41]]</p><!-- and this spec uses it once… -->
<p>To <dfn data-lt="resolving">resolve a URL</dfn> means to consider it a URL,
and convert it to its <a data-lt="absolute URL">absolute form</a>,
taking into account the address of the document in which it is found.<!-- and base elements, or not? #37 --></p>

<p>DOM 4.1 defines <dfn><code>textContent</code></dfn> for attributes, and for elements or nodes,
as well as the term <dfn id="tree-order">tree order</dfn>. [[!DOM41]]</p><!-- and this spec uses tree order once… badly -->

<p>This specification relies on the HTML specification to define the individual the following terms: [[!HTML52]]</p>


<ul>
<li><dfn>space characters</dfn>, <dfn>split a string on spaces</dfn>, and an
<dfn>unordered set of unique space-separated tokens</dfn>.</li>
<li><dfn>HTML elements</dfn>, <dfn>global attributes</dfn>, <dfn>boolean attribute</dfn>.</li>
<li><dfn data-lt="HTML elements">HTML Element</a>, <dfn>global attribute</dfn>, <dfn>boolean attribute</dfn>.</li>
<li>An element's <dfn>ID</dfn> and <dfn id="language">language</dfn>.</li>
<li><dfn>flow content</dfn> and <dfn>phrasing content</dfn>.</li>
</ul>
Expand Down Expand Up @@ -310,6 +320,7 @@ <h3>The basic syntax</h3>

</div>


<p>When a string value is in some machine-readable format unsuitable
for human consumption, it is expressed using the <code title="attr-data-value">value</code> attribute of the
<code>data</code> element, with the human-readable version given in
Expand Down Expand Up @@ -722,7 +733,7 @@ <h3>Items: <a>itemscope</a>, <a>itemtype</a>, and <a>itemid</a>.</h3>

<p>The <dfn id="global-identifier">global identifier</dfn> of an <a data-lt="concept item">item</a>
is the value of its element's <code><a>itemid</a></code> attribute, if it has one,
<a href="#resolve-a-url" title="resolve a url">resolved</a> relative to the element on which the attribute is specified.
<a data-lt="resolve a url">resolved</a> relative to the element on which the attribute is specified.
If the <code><a>itemid</a></code> attribute is missing or if resolving it fails, it
is said to have no <a href="#global-identifier">global identifier</a>.</p>

Expand Down Expand Up @@ -946,82 +957,74 @@ <h3>Properties: the <dfn data-lt="attr-itemprop"><code>itemprop</code></dfn> and
</section>

<section id="values">
<h3>Values</h3>
<h3>Values: the <dfn><code>content</code></dfn> attribute.</h3>

<p>The <dfn>property value</dfn> of a name-value pair added by an
element with an <code><a>itemprop</a></code> attribute
is as given for the first matching case in the following list:</p>

<p>The algorithm to determine the <dfn data-lt="property value">value</dfn> for a name-value pair
is given by applying the first matching case in the following list:</p>

<dl class="switch">

<dt>If the element also has an <code><a>itemscope</a></code> attribute</dt>

<dd>

<p>The value is the <a data-lt="concept item">item</a> created by the element.</p>

</dd>


<dt>If the element is a <code>meta</code> element</dt>
<dt>If the element has a <a>content</a> attribute</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>

<p>The value is the <a>textContent</a> of the element's <a>content</a> attribute.</p>
</dd>
<dd class="note">
<p>HTML only allows the <a>content</a> attribute on the <code>meta</code> element.
This specification changes the content model to allow it on any element, as a <a>global attribute</a>.</p>
</dd>


<dt>If the element is an <code>audio</code>, <code>embed</code>, <code>iframe</code>,
<code>img</code>, <code>source</code>, <code>track</code>, or <code>video</code> element</dt>

<dd>

<p>The value is the <a>absolute URL</a> that results from
<a href="#resolve-a-url" title="resolve a url">resolving</a> the value of the element's <code>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 <a href="#resolve-a-url" title="resolve a url">resolving</a> it results in an error.</p>

<p>If the element has a <code>src</code> attribute,
let <var>proposed value</var> be the result of <a>resolving</a> that attribute's <a>textContent</a>.
If <var>proposed value</var> is a <a>valid absolute URL</a>: The value is <var>proposed value</var>.<br>
<i>otherwise</i>The value is the empty string.</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 <a>absolute URL</a> that results from
<a href="#resolve-a-url" title="resolve a url">resolving</a> the value of the element's <code>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 <a href="#resolve-a-url" title="resolve a url">resolving</a> it results in an error.</p>

<p>If the element has an <code>href</code> attribute,
let <var>proposed value</var> be the result of <a>resolving</a> that attribute's <a>textContent</a>.
If <var>proposed value</var> is a <a>valid absolute URL</a>: The value is <var>proposed value</var>.<br>
<i>otherwise</i>The value is the empty string.</p>
</dd>


<dt>If the element is an <code>object</code> element</dt>

<dd>

<p>The value is the <a>absolute URL</a> that results from
<a href="#resolve-a-url" title="resolve a url">resolving</a> the value of the element's <code>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 <a href="#resolve-a-url" title="resolve a url">resolving</a> it results in an error.</p>

<p>If the element has a <code>data</code> attribute,
let <var>proposed value</var> be the result of <a>resolving</a> that attribute's <a>textContent</a>.
If <var>proposed value</var> is a <a>valid absolute URL</a>: The value is <var>proposed value</var>.<br>
<i>otherwise</i>The value is the empty string.</p>
</dd>


<dt>If the element is a <code>data</code> or <code>meter</code> element</dt>

<dd>
<p>The value is the value of the element's <code>value</code> attribute,
if it has one, or the empty string otherwise.</p>
<p>If the element has a <code>value</code> attribute, the value is that attribute's <a>textContent</a>.</p>
</dd>


<dt>If the element is a <code>time</code> element</dt>

<dd>
<p>The value is the element's <span>datetime value</span>.</p>
<p>If the element has a <code>datetime</code> attribute, the value that attribute's <a>textContent</a>.</p>
</dd>


Expand Down Expand Up @@ -1395,7 +1398,7 @@ <h2>Changes to HTML5</h2>
<section id="new-attributes">
<h3>New attributes</h3>

<p>This specification adds the following <a>global attributes</a> and associated validity constraints to HTML:</p>
<p>This specification adds the following <a data-lt="global attribute">global attributes</a> and associated validity constraints to HTML:</p>

<dl>

Expand Down Expand Up @@ -1436,6 +1439,10 @@ <h3>Content models</h3>

<p>This section changes the content models defined by HTML in the following ways:</p>

<p>The <code>content</code> attribute redefined by this specification as a <a>global attribute</a>
that may be present on that element.</p>
<p class="Note">This is consistent with [[HTML-RDFA]], which uses the attribute for the same purpose.</p>

<p>If the <code><a>itemprop</a></code> attribute is
present on <code>link</code> or <code>meta</code>, they are
<a href="#flow-content">flow content</a> and <a href="#phrasing-content">phrasing content</a>. The
Expand Down Expand Up @@ -1591,6 +1598,12 @@ <h2>Changes</h2>
<a href="http://www.w3.org/TR/2013/NOTE-microdata-20131029/">23 October 2013 W3C Note</a></p>

<ul>
<li>Allow the <code>content</code> attribute on any element where an <a>itemprop</a> attribute is present,
to provide a readable value for a property.</li>
<li>Adjust the algorithm for determining the <a>value</a> of a name-value pair, to match implementation:
<ul><li><code>data</code>, <code>meter</code>, and <code>time</code> elements' <a>textContent</a> is used
if they do not have an attribute that supplies the <a>value</a>.</li>
<li>If there is a <code>content</code> attribute present, it provides the <a>value</a>.</li></ul></li>
<li>Added sections for <a href="i18n-considerations">Internationalisation and localisation</a>, <a href="#privacy-considerations">Privacy</a>, and <a href="#security-considerations">Security Considerations</a>.
<li>Remove drag and drop, as it is not implemented in current browsers.</li>
</ul>
Expand All @@ -1611,7 +1624,7 @@ <h2>Acknowledgements</h2>
<p>The original specification for Microdata was developed by Ian Hickson.
Uptake has been substantially been driven by its use for the schema.org vocabulary.</p>

<p>The current editors would like to thank the following people for direct contributions to their work:</p>
<p>The current editors would like to thank the following people for direct contributions to this work:</p>

<p>
Gregg Kellogg,
Expand Down

0 comments on commit 87aad02

Please sign in to comment.