W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2012

Re: [whatwg] Issues with microdata and proposals for improvements

From: pghj <pghjvanblokland@gmail.com>
Date: Sat, 13 Oct 2012 15:21:56 +0200
Message-ID: <CALOJz9GzA6XQ9Oe32SyTsY0eOzk96m94UR+_gxed5_gBmsSEQw@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: whatwg@whatwg.org
On Fri, Oct 12, 2012 at 6:43 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> On Fri, Oct 12, 2012 at 7:28 AM, pghj <pghjvanblokland@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
Received on Saturday, 13 October 2012 13:22:30 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:11 GMT