Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
363 views
in Technique[技术] by (71.8m points)

html - How is Value determined for an Anchor Tag with Microdata?

How do Google and others determine the value of an itemprop on an Anchor tag?

 <a href="foo.html" itemprop="barprop">Name Of Link</a>

In the example above, is the itemprop's value the href attribute, much like how the link tag is parsed? Or is the value the innerHTML, as a standard block element is parsed?

I've searched quite a bit and cannot find the answer. I'm open to all answers, but I'd very much like a source for the answers given so I can further investigate.

Thanks in advance!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The Microdata spec (which is now merely W3C Note) defines:

If the element is an a, area, or link element
The value is the absolute URL that results from resolving the value of the element's href attribute relative to the element at the time the attribute is set, or the empty string if there is no such attribute or if resolving it results in an error.

Exception: when the a/area/link element has an itemscope attribute, then the itemprop "value is the item created by the element", not the href value.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...