XML DOM hacking in MSIE: halp!

Jun 01, 2007 23:25

Righto, I just sacrificed a couple of hours on the altar of trying to get shit to work in MSIE. On the plus side, I think I can eliminate one of the third-party libraries I've been using; MSIE was barking at it, and I find that I can do the same thing it was doing using Prototype, which the application already depends on ( Read more... )

msie, xml, javascript, rage, programming

Leave a comment

Comments 19

chocorisu June 2 2007, 04:14:24 UTC
msdn.microsoft.com... it's a pain to search but it's all on there. Handy trick: use "site:msdn.microsoft.com" to search it with Google. It'll be way less painful than using Microsoft's search tools.

Reply


jaq June 2 2007, 06:49:24 UTC
You might find Sarissa helpful?

Reply

jaq June 2 2007, 06:51:48 UTC
p.s. I have a bit of code at work that does something similar - I'll refresh my memory on Monday.

Reply


cnoocy June 2 2007, 12:34:23 UTC
Is xml_doc even defined? You may need different syntax there.

Reply

prog June 2 2007, 15:50:26 UTC
Yeah, it's defined. Note that peeking at its documentElement property doesn't make JS crap out (as it would if it were null). And it does self-identify as an XML document node if you ask it.

Reply


ahkond June 2 2007, 12:46:26 UTC
What do you get from alert(xml_request.responseXML)? Just to see whether it's empty or not ...

Is it possible that calling xml_request.responseText empties the xml_request object, and that subsequently calling .responseXML therefore returns an empty XML document?

Reply

misuba June 2 2007, 15:43:06 UTC
No, responseXML should still be there. XHR objects aren't one-use like that. This does not mean that IE is doing anything sensible with the XML once it gets it, however. (I can't shake the feeling that it just has some minorly different way to get there than 'documentElement', but for the life of me I... ooh! I know! The flamingo book! I'll be right back)

Reply


misuba June 2 2007, 15:38:43 UTC
I'm betting that that library code is the result of a packing algorithm meant to reduce the time it takes to move the JS over the wire. There may be a more readable version available. OTOH, that looks pretty lengthy for packed JS.

I found a few articles on JS and XML that have techniques that might be helpful, but they aren't anything the most casual googler couldn't dig up. There is this, though, if you don't have something like it (it ain't Firebug but it's pretty handy): JavaScript Shell for IE

Reply

prog June 2 2007, 15:45:21 UTC
Everyone knows it loads faster if you remove all the whitespace. Naming your variables through keymashing makes it even better.

Reply

misuba June 2 2007, 16:05:02 UTC
Seriously, for libs like Prototype that get up to 200K when you add script.aculo.us to the picture, some of those techniques can really count. I've seen 75% reductions.

Reply

prog June 2 2007, 16:23:48 UTC
gzip, m'man.

I have yet to come to a place where it's worth sacrificing maintainability for optimization. Or anything else.

I'm not saying there is no such place... but I haven't been there yet, if so.

Reply


Leave a comment

Up