[Javascript] innerHTML in xhtml (was: document.all for NETSCAPE)

liorean liorean at gmail.com
Wed Oct 13 06:43:43 CDT 2004


On Wed, 13 Oct 2004 11:23:46 +0200, Peter-Paul Koch <pp.koch at gmail.com> wrote: 
> How do you create an application/xhtml+xml page that will work in Mozilla? I just tried it, because I wanted to test this bit of lore, but it doesn't work.
> See http://www.quirksmode.org/dom/innerhtmltest.xhtml, the MIME type is application/xhtml+xml . Works fine in Opera (and innerHTML works fine, too), but Mozilla only shows it as an XML page, and doesn't seem to interpret the HTML/CSS. What's gone wrong now?

It does, but you must realise that Mozilla isn't an XHTML1 user agent,
it's a non-validating XML user agent with knowledge of the XHTML1
namespace and MIME type. Thus, if the document does not use the XHTML1
namespace, it won't be treated as XHTML1. And you must use the
namespace in all XHTML documents anyway, it's required by the DTD.
(The reason? Why, XHTML1 and XHTML2 will have incompatible semantics,
but share the same MIME type. The namespace tells the user agent which
semantics it should use.)

> Finding a doctype was tricky, too (<!DOCTYPE html PUBLIC "-//W3C//DTD
> XHTML 1.0 Strict//EN"> was not good enough, Moz and Op complained
> about the last bracket).

In XML DOCTYPE declaration of the PUBLIC type requre both the PublicID
and the SystemID. (SystemID is the URL to the DTD.)
 
> I can understand why no one creates such pages.

Bah, you're just frustrated because your first shot at it failed...
-- 
David "liorean" Andersson
<uri:http://liorean.web-graphics.com/>



More information about the Javascript mailing list