[Project_owners] XPATH: Evaluating the window.content

Renato R. (RRaver) rraver.sp at gmail.com
Sun Apr 9 17:49:33 EDT 2006


Hi Guys,

I need to evaluate a query in the loaded document (window.content?) and 
store it in an array. but I tried a lot of methods and have no success.

I tried to do something like this, replacing the 
"PATH_TO_THE_LOADED_DOCUMENT" by a lot of things...but it always return 
0 in the array, or undefined or does't work in general..

function myFunction() {
        var links = 
PATH_TO_THE_LOADED_DOCUMENT.evaluate("/html/body//a", document, null, 
7,null);
        for (var i = 0; i < links.snapshotLength; i++) {
            DO_SOMETHING_WITH(links.snapshotItem(i));
        }
}
window.addEventListener('load', myFunction, true);

If I put this code in a Greasemonkey script it works OK using 
document.evaluate but if I put it in an extension (my intention) it 
doesn't work with document.evaluate

Someone can help?

Many thanks

__
Renato Rodrigues (RRaver)
http://www.renatorodrigues.com
http://orkutbar.mozdev.org



More information about the Project_owners mailing list