24 Oct

firefox not properly parsing XML/XHTML ?

Look at these examples – semantically, they are exactly the same:

<ul><li />one<li>two</li><li />three</ul>

In both cases, they are invalid, but Firefox renders one of them correctly and not the other…

example one

  • one
  • two
  • three

example two

  • one

  • two
  • three

Interesting! Noticed while explaining why ‘ /’ is used at the end of self-closing elements in XHTML.

2 thoughts on “firefox not properly parsing XML/XHTML ?

  1. How are you testing this? Is the document being sent with the correct xhtml mimetype (application xml+xhtml)? Otherwise you are just testing the cleanup routine of tagsoup HTML.

  2. whether the mime-type is correct or not (it’s not – it’s text/html, and an XHTML Doctype) should not matter – what matters is that <li /> means exactly the same as <li></li> and should be treated the same.

    Besides – what’s the point of a Doctype if you’re going to ignore it and only trust the mime-type?

    Not that I really care – it’s just a curious treatment of invalid code anyway.

Comments are closed.