In the following example, Microdata’s itemref
attribute is used to add the email
property to the Person
item (both from a fictive Microdata vocabulary).
<body>
<div itemscope itemtype="http://example.org/Person" itemref="orphan">
<span itemprop="name">Alice</span>
</div>
<div id="orphan" itemprop="email">
[email protected]
</div>
</body>
Is this valid Microdata?
If I understand the "Associating names with items" algorithm correctly, the "itemref
ed" properties are not moved but copied, which leaves this "orphan" itemprop
without an item parent.
There are three valid cases for itemprop
values. The following one seems to come closest:
If the item is not a typed item: a string that contains no "." (U+002E) characters and no ":" (U+003A) characters.
(Which would mean that the orphaned property is not a "defined property name", i.e., it doesn’t belong to the fictive vocabulary anymore (only the "copied" property does).)
But: there is no "item" involved, as there is no itemscope
.
So you can’t specify itemprop
without a parent itemscope
at all? Doesn‘t seem so:
Every HTML element may have an itemprop
attribute specified […]
What am I’m missing in the Microdata specification?
Does an itemprop
without an itemscope
parent create an item?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…