[webkit-gtk] document.getElementsByTagName('body')[0] undefined?

Kuba Wrożyna edpl90 at gmail.com
Sat Jan 23 09:20:22 PST 2010


Hi there,
I'm loading in webkit.WebView some page with simple script:

function appendtext(text){
	a=document.body.scrollHeight;
	b=document.body.clientHeight;
	c = document.body.scrollTop;
	var body= document.getElementsByTagName('body')[0];
	var newline= document.createElement('font');
	newline.setAttribute('size','-3');
	newline.innerHTML=text+'<br/>';
	body.appendChild(newline);

	if (a-b==c){
	 scroll()}}


and... if I run it inside the page, like this:	<a
onclick="appendtext('blablabla');">test</a> it works fine. But if I
try to run it from code:

self['chat'].execute_script("appendtext('"+text+"');")

it raises error in: var body=
document.getElementsByTagName('body')[0]; saying body is undefined...
why's that?

--
Kuba


More information about the webkit-gtk mailing list