Wednesday, January 24, 2007

Pushing to the edge of insanity and then reeling it back in

XML Whitespace: FireFox

Is there anything more gratifying than failing over and over in finding a bug and then discovering the problem in a single moment?

Not normal fare for this blog, but many, and I mean many hours of stumbling through cross-browser JavaScript XML parsing and I finally discovered the culprit.

Node selection was ok in IE but failing in FireFox. When I get down to a count of nodes found, there was a difference between IE and FireFox - weird is that there were no problems with a preceding XML selection function.

When I count all the possible nodes in the XML doc to see if the child nodes are selecting differently, there is always 1 more than what's there???

Finally, I check the 2 different xml docs and notice that 1 has no spaces or tabs - the one that works. When I remove all spaces and tabs, everything syncs back up between both browsers.

I look and cannot find an equivalent to preserveWhiteSpace = false for FireFox, so I have to either ensure there is none, or write a function that strips it prior to xml parsing.

This post is in dedication to anyone struggling like I did. I did a lot of searching and didn't find anything that gave me any clue as to the issue. Hopefully this will save some time for anyone in a similar situation.

1 Comments:

At August 5, 2007 at 10:16 AM , Blogger Dragomir Tenev said...

Hey man, I just wanted to say that this article you have written is great. Continue working in the same way!

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home