Skip to the Main Content

Note:These pages make extensive use of the latest XHTML and CSS Standards. They ought to look great in any standards-compliant modern browser. Unfortunately, they will probably look horrible in older browsers, like Netscape 4.x and IE 4.x. Moreover, many posts use MathML, which is, currently only supported in Mozilla. My best suggestion (and you will thank me when surfing an ever-increasing number of sites on the web which have been crafted to use the new standards) is to upgrade to the latest version of your browser. If that's not possible, consider moving to the Standards-compliant and open-source Mozilla browser.

March 25, 2003

Javascript Bug

Well, I faced an interesting choice.

My Comment Popup used to have a functioning “rememberMe” javascript. But it did not render MathML (since the Content-Type was set to “text/html”).

I changed this to “application/xhtml+xml” when served to Mozilla. Alarmingly, doing so somehow breaks the aforementioned javascript.

If any of the experts have a fix, I’d love to hear it. I suspect, though, that this may be a Mozilla bug.

Update: It’s not a “bug, it’s a “feature”. When served as a text/html, the document is governed by the DOM for HTMLDocument. Firing up Mozilla’s DOM Inspector, (I’ve never done that before!) we see that, indeed, HTMLDocument has a cookie attribute. And we can refer to document.cookie in a Javascript to get at it.

When served as a application/xhtml+xml, Mozilla says the document is governed by the DOM for XMLDocument. And, firing up the old DOM Inspector again, we discover that … whoops! … there is no cookie attribute for XMLDocument, and not a hint of how to access the document’s associated cookies.

This surely cannot be what the W3C had in mind when they said XHTML 1.1 documents should be served as application/xhtml+xml.

Does anyone understand this stuff? I don’t; I am only dimly mouthing words I found on the internet. But if the above description is correct, the situation is utterly, criminally brain-dead. Whadya mean one can’t have cookies in XHTML?

Posted by distler at March 25, 2003 11:29 AM

TrackBack URL for this Entry:

3 Comments & 0 Trackbacks

Re: Javascript Bug

I’m not sure about this, but I suspect you need to define an additional DTD to handle this in the header of your XML document (that’s how the X part of XML works). What is that DTD? Dunno.

Posted by: Adam Rice on April 7, 2003 9:47 AM | Permalink | Reply to this

Re: Javascript Bug

Nope. It’s a DOM issue, not a DTD issue. And it is definitely a Mozilla bug

Posted by: Jacques Distler on April 7, 2003 10:17 AM | Permalink | Reply to this

Re: Javascript Bug

I see. So much for that theory.

Posted by: Adam Rice on April 9, 2003 8:52 AM | Permalink | Reply to this

Post a New Comment