James Revillini

Say 'no' to styrofoam.

Tag: javascript

Dynamically populate an element styled with white-space: pre


You cannot use:

You must do this:

Lame, huh?

Condiments for SWFUpload Initial Release

I have released a kit which aims to make life a little easier for those of you who want to spruce up the SWFUpload interface with some style. An example using the tango desktop project theme:

Screenshot of Condiments in action.

‘no element found’ in firebug or firefox javascript console (part 2)

I was right. If the server sends a response and the ‘Content-Type’ attribute is ‘text/xml’, you must send at least a root node so the xml parser that is built into Mozilla’s XMLHTTPRequest object doesn’t cak and give you a ‘no element found’ Javascript error.

This could be an issue for those of us who are trying to do the REST thing and send back proper status codes depending on the request method and actions taken by the server. A 204 (Updated) or 205 (Deleted) response cannot, by definition, have any content body, so sending a root node is not an option to get around this error. The server needs to determine if the response is going to have an xml content body and assign the Content-Type on the fly.

‘no element found’ in firebug or firefox javascript console

I think I figured it out. I think that the issue crops up if your server sends a response header of ‘Content-Type’ set to ‘text/xml’ and you send no content. The XMLHTTPRequest object then says ‘oh it’s xml? fine – i’ll just PARSE THIS and store it in the reponseXML property.’ At that point, the XML Parser probably bombs and nothing catches it. But anyway that’s just a hunch and I’m only blogging about it because I’m bored. I’ll have test results available later.

© 2017 James Revillini

Theme by Anders NorenUp ↑