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
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.