I think there is a bug in the E4X implementation XML.replace function:
Rhino 1.7 release 2 2009 03 22
AFAIK the code should remove all the <br/> nodes, but the first one
remains. I also tested in FF3.6 and there the <br/> nodes are properly
I experienced this in 1.6r7 as well.