Tse Shing Chi (Franklin/Whale) wrote:
Lachlan Hunt wrote:
Ah, but this works!
<html>
<head>
<title>Feed Autodiscovery</title>
</head>
<body>
<p>... really long body ...</p>
<link rel="alternate" type="application/atom+xml" href="/feed">
</body>
</html>
Your example is a invalid HTML document.
<link> can only be put inside <head>.
That's not the point. In the real world, authors make many stupid
mistakes and elements appear all over the place, which browsers have to
deal with.
While you have mentioned HTML 5, you may take a look on XHTML 2.
XHTML 2 allows all elements inside <body> to have a "href"
attribute and thus they can be a link without using <a>. It is
very complicated case for UAs to scan all.
XHTML 2 effectively dead. That href-on-any-element feature is one that
browser vendors have already stated to be difficult to implement. In
fact, XHTML 2 as a whole is already near impossible to implement in the
real world, and, if the WG goes through with their stated plan to reuse
the XHTML 1.x namespace, it will be totally impossible to implement.
Therefore, XHTML 2 is irrelevant to this discussion.
IE 7 is actually doing a good job, it is rejecting all <link> elements
which are put in a wrong position.
No, IE's behaviour is extremely inconsistent and buggy. This test
actually works in IE.
<!DOCTYPE html>
<title>Autodiscovery</title>
<div>
<link rel="alternate" type="application/atom+xml"
href="http://lachy.id.au/log/feed">
<p>This case still works in IE!
</div>
I cannot understand why Firefox, Opera and Safari detect the links.
Because they have to deal with real world content. For example,
although this isn't a an autodiscovery link, see where Google have
placed the prefetch link in this page.
http://www.google.com/search?q=Microsoft
<link rel="prefetch" href="http://www.microsoft.com/">
Because browsers have to handle all link elements the same way,
regardless of their attributes, they also have to handle the equivalent
for autodiscovery links.
--
Lachlan Hunt
http://lachy.id.au/