The replace is to handle URL.parse returning 'file:' in the case of HREF="./pix/submit.gif", which should return 'http:' (as chrome/safari/firefox did). I guess it would fail if href="file://somepath". I'll add one more assert in the tests for that condition and update the replace to only change it when there isn't a specific protocol in the href.