I have read the HTML5 specification, the microdata specification, and the WHATWG HTML5 (with microdata) specification. These are well written and easy to understand.
But now I read the schema.org Book specification, and came across snippets like the following:
<span itemprop="price" content="6.99">$6.99</span>
<span itemprop="inLanguage" content="en">English-language</span>
<span itemprop="name" content="Tolkien, J. R. R. (John Ronald Reuel)">
J. R. R. Tolkien</span>
Apparently (compare with the JSON version), the values of these microdata properties are the values of the content
attributes of the span
elements. (Of course, if there is no content
attribute, the value is instead the textContents
of the span
element.)
But I cannot find any support for this practice in the HTML and microdata specifications. In fact, I cannot even find any evidence that there is a content
attribute on span
elements at all!
The microdata specification doesn't say anything about a span
content
attribute when it gives the rules for values. [Unless 'the element's textContent' is overridden by the content
attribute, but I cannot find any support for this either.]
Not even the full WHATWG HTML5+microdata specification supports the claim that there is a content
attribute on span
(see The span
element and Global attributes).
So, I suppose the schema.org example is non-conforming. But is it also plain wrong? If not, where does this practice come from, and how accepted is it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…