Re: Microdata: The Itemref element

On Mon, Oct 19, 2009 at 1:35 AM, Anne van Kesteren <annevk@opera.com> wrote:
> On Sun, 18 Oct 2009 23:59:01 +0200, Ian Hickson <ian@hixie.ch> wrote:
>>
>> On Sun, 18 Oct 2009, Nicholas Stimpson wrote:
>>>
>>> Instead, would it be possible for the element with the "itemscope"
>>> attribute to have an itemref attribute that was a space separated list
>>> of ids?
>>
>> It'd certainly be possible, but I'm not sure it's desireable, given how
>> easy it is to work around.
>
> FWIW, that design sounds much nicer to me than having an <itemref> element
> somewhere as a descendant do the trick. It is more clear what the
> relationship is, does not have legacy parser issues, is easier to implement
> using scripting, and more consistent with other such structures (usemap,
> for).

Agreed. I also like the idea of microdata being purely a set of
attributes. Mostly because it keeps the markup more readable IMHO. An
element attracts a lot more attention when skimming over markup than
an attribute does. Especially if the markup is written for readability
like:

<foo>
  <voidelementbar>
  <baz>text</baz>
</foo>

And I think it's better that the main document structure is what
attracts attention, rather than being distracted by microdata markup.

Further, not having to change the element structure of the document in
order to add microdata makes it somewhat safer to add since there's
much less reason to worry about scripts that expects a certain DOM
structure breaking.

Neither of the two suggested workarounds are particularly nice:

1. Wrapping a <span> around the <itemref> means that microdata
attracts even more attention when writing the markup.
2. Putting the <itemref>s last in an element seems opposite from where
you'd intuitively put them. It seems to me more intuitive to put them
close to where the item is declared, i.e. the 'itemscope' attribute.

/ Jonas

Received on Monday, 19 October 2009 09:39:51 UTC