同一元素上的 'itemprop' 和 'rel' 属性
'itemprop' and 'rel' attributes on same element
在同一元素上使用 itemprop
属性 和 rel
属性是否有效?
来自 Google’s Site Name documentation 的示例包含
<link rel="canonical" href="https://example.com/" itemprop="url">
在 https://validator.w3.org/nu/ 中出现此错误:
Attribute rel
not allowed on element link
at this point.
这取决于规格。
itemprop
属性来自的微数据是 defined by WHATWG’s HTML as well as by W3C’s HTML Microdata。
WHATWG 版本是没有快照的生活标准(所以事情可能会改变;我的引用来自 2015-07-25),W3C 版本目前只有 Working Group Note from 2013,没有 推荐.
对于 a
元素和 area
元素:
- 两种规范都允许同时使用属性
itemprop
和 rel
对于 link
元素:
WHATWG:不允许一起使用这些属性
A link
element must have either a rel
attribute or an itemprop
attribute, but not both.
W3C:允许一起使用属性
If a link
element has an itemprop
attribute, the rel
attribute may be omitted.
在同一元素上使用 itemprop
属性 和 rel
属性是否有效?
来自 Google’s Site Name documentation 的示例包含
<link rel="canonical" href="https://example.com/" itemprop="url">
在 https://validator.w3.org/nu/ 中出现此错误:
Attribute
rel
not allowed on elementlink
at this point.
这取决于规格。
itemprop
属性来自的微数据是 defined by WHATWG’s HTML as well as by W3C’s HTML Microdata。
WHATWG 版本是没有快照的生活标准(所以事情可能会改变;我的引用来自 2015-07-25),W3C 版本目前只有 Working Group Note from 2013,没有 推荐.
对于 a
元素和 area
元素:
- 两种规范都允许同时使用属性
itemprop
和rel
对于 link
元素:
WHATWG:不允许一起使用这些属性
A
link
element must have either arel
attribute or anitemprop
attribute, but not both.W3C:允许一起使用属性
If a
link
element has anitemprop
attribute, therel
attribute may be omitted.