[whatwg] Issues with microdata and proposals for improvements
pghj
pghjvanblokland at gmail.com
Sat Oct 13 06:21:56 PDT 2012
On Fri, Oct 12, 2012 at 6:43 PM, Tab Atkins Jr. <jackalmage at gmail.com> wrote:
> On Fri, Oct 12, 2012 at 7:28 AM, pghj <pghjvanblokland at gmail.com> wrote:
>> == Incompatible property names when using itemrefs ==
>>
>> Consider the following piece of HTML:
>>
>> <div itemscope itemtype="http://schema.org/Book" itemref="a"> ... </div>
>> <div itemscope itemtype="http://schema.org/LiteraryEvent" itemref="b">
>> ... </div>
>> <div id="a" itemprop="author" itemscope
>> itemtype="http://schema.org/Person" itemref="c"></div>
>> <div id="b" itemprop="performer" itemscope
>> itemtype="http://schema.org/Person" itemref="c"></div>
>> <div id="c">
>> Name: <span itemprop="name">Amanda</span>
>> </div>
>>
>> Actually, the 'Book' item and the 'LiteraryEvent' item both want to
>> refer to the same person: the first as the author, the second as a
>> performer. Because the property names differ, I can't seem to find a
>> proper way to do this using itemrefs, without either polluting other
>> items, or creating two 'Person' items (as I did above). Both
>> approaches are undesirable.
>
> You can put more than one property in a single itemprop attribute.
> Just drop #a and #b, move the itemscope to #c, and put
> itemprop="performer author" on it.
>
> ~TJ
Thank you for the suggestion, but I want to avoid this:
It is what I meant by "polluting other items": 'Book' does not want a
'performer', and 'LiteraryEvent' does not want an 'author'. Even
though in this case I could ignore the 'illegal' properties, in other
scenarios items might allow both properties, while I would only want
to assign one of them.
Also, an itemref to 'illegal' properties would violate: "Each token
must be either: [...] If the item is a typed item: a defined property
name allowed in this situation according to the specification that
defines the relevant types for the item [...]" in section "Names: the
itemprop attribute" of the microdata spec.
Josh
More information about the whatwg
mailing list