[Conkeror] Access to page elements from user defined functions - ERROR

Jeremy Maitin-Shepard jeremy at jeremyms.com
Tue Apr 8 22:28:32 PDT 2008


"Demyan Rogozhin" <demyan.rogozhin at gmail.com> writes:

> Hi,
> I'm trying to modify current page from interactive function and got error.

> I write in my RC-file:

> interactive("my_function", function(I){
> 	var doc =  I.buffer.document;
> 	var mycss=doc.createElement('link');
> 	mycss.id ='mycss';
> 	mycss.rel='stylesheet';
> mycss.href='data:text/css,'+escape("*{background-color:white;color:black;}");
> 	doc.getElementsByTagName("head")[0].appendChild(mycss);
> }

> When I make M-x: my_function I got:
> TypeError: doc is undefined
> file:///home/me/conkerorrc.js:66
> ([object Object])@file:///home/me/conkerorrc.js:66
> call_interactively([object
> Object],"my_function")@chrome://conkeror-modules/content/interactive.js:96
> meta_x([object ChromeWindow],(void
> 0),"my_function")@chrome://conkeror-modules/content/commands.js:111

> And pointed to "var mycss=doc.createElement('link'); " - string#66 of
> my RC file.

> I read http://conkeror.jeremyms.com/WritingCommands and I expect that
> I.buffer.document point me to current page's DOM object.

> Any ideas for this?

We recently changed to the name I.buffer.document instead of
I.buffer.top_document.  Updating Conkeror may fix the problem.

-- 
Jeremy Maitin-Shepard


More information about the Conkeror mailing list