I'm not actually sure on this one.  I copied the code from the fixupUrl function in dojo.js (line: 1298).  I have no idea whether this is to fix some fringe situation so thought I better leave it in.  It might be something relating to rhino? Maybe, someone in the wider community knows whether this needed or not; if not we could just remove it?  People's thoughts on this would be welcome.