Forum:Document.evaluate not working

I have this javascript code in my user javascript page. (The alerts are just so I can see whats going on.) alert('test'); var theBrokenLinksxyz = document.evaluate('//a[contains(@title,"(page does not exist)")]',document.body,null,6,null); alert('theBrokenLinksxyz='+theBrokenLinksxyz); for (i=0;i<theBrokenLinksxyz.snapshotLength;i++){ var theMatch = theBrokenLinksxyz.snapshotItem(i).href.match(/\?title=(.*)&action/)[1]; theBrokenLinksxyz.snapshotItem(i).href = 'http://en.wikipedia.org/wiki/'+theMatch;} alert('done'); When I run it all I see is the first alert. The one that says 'test'. This code (minus the alerts) was working recently then I had to go and mess around with it and now it doesnt work. The code came originally from greasemonkey userscripts. As you can see from that page this issue is not new. I am sure that I have reset it to exactly what was working before. When I run it on wikipedia I get all three alerts but the second one reads theBrokenLinksxyz=[object XPathResult] If it were working properly then theBrokenLinksxyz would be a list of all the links that contain (page does not exist) in their title. The loop would then redirect those links to wikipedia. I have no idea whats going on. Granpa 05:54, May 16, 2011 (UTC)