Is 'itemprop' without parent 'itemscope' valid? Does it create an item?

你说的曾经没有我的故事 提交于 2019-11-29 15:36:05

The spec requirement is just that the itemprop is used in at least one item. There's no suggestion that I can see that being referenced by an itemref does not constitute a usage, nor that the itemprop is copied, and that it is the copy which is used not the original. So I think the spec requirements are fulfilled, and the microdata is valid.

Moreover, consider the intent of the spec. The underlying idea is that an itemprop that is not used by any item is pointless - a waste of typing - an therefore must be an authoring mistake. That is sufficient for mark-up to be considered invalid. Since that is not the case here, there is no justification for making such a construct invalid.

  1. Is this valid Microdata?
    • Yes it is!
  2. Does an itemprop without an itemscope parent create an item?
    • No it doesn't!

An item is created by the itemscope attribute. With or with out properties, it is an item ones you declared it as an item. An itemprop declares the property of an item, it will never create it. It is still valid html to have the itemprop attribute declared on "orphans" sense there is no dependencies in html on attributes like does on elements.

http://www.w3.org/TR/2011/WD-microdata-20110405/#the-basic-syntax 9:th example describes the topic bit.

I work with these type of extractions a lot. The way I designed the software is to look for the root of every item, that's where the scope is declared. I then extend the scope if a reference is declared. I never look for properties outside the scope sense it's irrelevant.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!