Forum Moderators: open
<a name="content" />
Now I thought that would be invalid, but it seems to validate fine.
However, Safari was not happy and tries to render all content on the entire page as a single link.
So I guess it needs to be changed back to
<a name="content"></a>
So is this right, this is valid code but Safari has a bug?
text/html - which you almost certainly are doing as from memory Safari (and Konqueror on which Safari is based) does not support "true" XHTML served as application/xhtml+xml. In other words, Safari is an HTML parser, and you are sending markup which isn't actually HTML, just pretending to be HTML.
The validator is technically correct, but unhelpful (and verging on misleading) as the markup example isn't compatible with HTML.
br does not have a closing tag. So
<br /> is read as <br> - which works. <a name="content" /> is read as <a name="content"> - which opens a link up until a subsequent </a> (or the end of the page if there is no appropriate closing tag). The closing slash is invalid HTML, and you are declaring the page is HTML via the mime type. So, Safari is working according to HTML specifications, and the other browsers are using their error-handling routines to fix the malformed HTML. You can consider the other browsers' approach as being superior, but it doesn't make Safari's approach wrong. :)