[Project_owners] Re: XPATH: Evaluating the window.content

Renato R. (RRaver) rraver.sp at gmail.com
Sun Apr 9 18:07:55 EDT 2006


Oh... nevermind...

Stupid newbie question... :-[

I just replaced:
var links = PATH_TO_THE_LOADED_DOCUMENT.evaluate("/html/body//a", 
document, null, 7,null);

by:
var links = document.evaluate("/html/body//a", window.content.document, 
null, 7,null);

and it worked OK.

sorry for bothering you guys...

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

Renato R. (RRaver) escreveu:
> 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