Element link is missing required attribute property

前端 未结 6 1151
清歌不尽
清歌不尽 2020-12-12 23:47

...


        
6条回答
  •  执念已碎
    2020-12-12 23:47

    W3C HTML5 validator maintainer here. As pointed out in another answer, in addition to checking requirements in the HTML5 spec itself, the validator also checks against requirements in the HTML+RDFa 1.1 spec:

    http://www.w3.org/TR/html-rdfa/

    And while the HTML spec itself says link is normally not allowed in the body*, the RDFa spec says that if a link element has a property attribute, it is allowed in the body.

    So that validator message is basically saying,「The link element is only allowed here if it has a property attribute. But this particular link element doesn't have a property attribute.」

    * The HTML spec itself does also say that the link element is allowed in the body if it has an itemprop attribute—but only if the link element doesn't have a rel value. (itemprop is “Microdata” attribute whose purpose is basically the same as the RDFa property attribute).

    So we have two different attributes that both independently affect where in a document the link element is allowed to appear, and that complicates the checking logic in the validator in a way that makes it difficult to emit a better, more helpful error message for this case.

提交回复
热议问题