I encountered this page https://www.google.com/accounts/ServiceLogin, a Google service login page that (beyond just omitting a doctype), contains 6 instances of </img>
For example,
<img src="https://www.google.com/accounts/google_transparent.gif"
alt="Google">
</img>
Why would they ever do that? What benefit/functionality/grandfathering do they possibly achieve?
Anything I’ve ever read about HTML and XHTML has made it pretty unequovical:
In HTML 4.01 and prior, <img> tags are never to be closed ( <img src="img.gif" alt="text" >).
In XHTML, <img> tags are to be closed using self-closing syntax ( <img src='img.gif' alt="text" />)
In HTML5, (my understanding is that) either syntax (open or self-closed) is acceptable, but still never </img>.
I’ve found the only (proposed) way this code is ever actually compliant, though it does not apply in Google’s case (since they lack a DOCTYPE).
XHTML 2, which was proposed and then scrapped, implements a
</img>tag as a way to replace the alt attribute.So, instead of this in XHTML 1.0/1.1:
<img src="monkeys.gif" alt="Monkeys throwing feces" />You’d have this
<img src="monkeys.gif">Monkeys throwing feces</img>Where ‘Monkeys throwing feces’ only displays if monkeys.gif fails to load.
This would make
<img>behave as other content embedding tags, like<object>.In the spec’s words,