Getting rid of img alt=”

Interesting. So Firefox (1.0) displays <img src='...'>text</img> when sent as application/xhtml+xml as just an image, as you would expect. There’s no yellow screen of death, because it’s valid XML, if not valid XHTML. Unfortunately it doesn’t work quite perfectly, because if the image is not available nothing is displayed. It would be interesting to see how Opera and Safari/KHTML render this.

The validator, though, is a different story. It gives these error messages:

  1. Line 1, column 280: required attribute "alt" not specified

    ...google.com/images/firefox/google.gif'>text</img></div></body></html>

  2. Line 1, column 281: end tag for "img" omitted, but OMITTAG NO was specified

    ...oogle.com/images/firefox/google.gif'>text</img></div></body></html>

  3. Line 1, column 222: start tag was here

    ...'text/css'></style></head><body><div><img src=’http://www.google.com/images/f

  4. Line 1, column 290: end tag for element "img" which is not open

    .../images/firefox/google.gif'>text</img></div></body></html>

Wouldn’t a simple “This element cannot contain content” suffice for three out of the four?

One Response to “Getting rid of img alt=””

  1. Anne says:

    It’s well-formed XML. Probably not valid XML. Agreed on the validator feedback, you can e-mail those guys ;-)


Bad Behavior has blocked 424 access attempts in the last 7 days.