itemprop-requires-itemscope
どのアイテムにも property を貢献していない itemprop 属性を警告します。
A document must not contain any elements that have an itemprop attribute that would not be found to be a property of any of the items in that document were their properties all to be determined.
HTML Living Standard §5.2.5 — Associating names with items より引用。itemprop 属性自体の定義は §5.2.3 — Names: the itemprop attribute にあります。
要素がアイテムに属しているのは、次の いずれか を満たす場合です:
- 祖先要素が
itemscope属性を持っている - 自要素の
idが、どこかのitemscope要素のitemrefトークンリストから参照されている
❌ 間違ったコード例
<span itemprop="name">孤立したプロパティ</span>
✅ 正しいコード例
<!-- itemscope を持つ祖先がある -->
<div itemscope>
<span itemprop="name">アイテム内</span>
</div>
<!-- itemref で参照されている -->
<div itemscope itemref="ref-name"></div>
<span id="ref-name" itemprop="name">itemref 経由で到達可能</span>
Interface
{
"itemprop-requires-itemscope": boolean
}
どのアイテムにも属していない itemprop を警告します。
Default Severity
error