March 02, 2005

Sarissa flip-flop

I've been using Sarissa for a while now every time i need to do some sort of client side scripting involving XML. It's a nice wrapper around the browser specific XML objects to allow you to run the same code in both Firefox and IE without too much fuss. I've been working on a tricky XSL script for the past few days and i kept running into a problem. I wanted to rule out the possibility that the unexpected results were coming from Sarissa so i stopped by the site to make sure i had the most recent version. I didn't. I've been using version 0.9.0 and the latest is 0.9.5.1. I thought i could just swap files and give er another go. That turned out to be far more difficult than i had expected.

The older file used IE's API as the standard and reshaped the Mozilla stuff to match. At some point when those version decimal places changed, they decided to use the Mozilla standard instead. I'm not saying it's the wrong choice, but it just took me a while to adjust because i have never had to use those objects before. I spent a good part of a day refactoring my code to use the new objects. I'm very surprised that methods like selectNodes and selectSingleNode are IE specific. The XML DOM seems so useless without those (unless i'm missing something). Luckily the latest version does include support for such methods though the inclusion of a second script file.

In the long run, i'm sure they made the right choice. Hopefully Safari will soon support full XML / XMLHTTP / XSL capabilities, and when they do it's probably safe to assume they will use something close to the Mozilla standard. It's always nice to have help fighting the cross-browser wars.

I finally got the code up and running again only to learn that Sarissa wasn't my problem at all. The quirk seems to lie somewhere deeper in core of Firefox. I'm still playing with it to figure out exactly what's going on.

Posted by Matthew at March 2, 2005 08:23 PM
Comments