JS regression - found the problem

David Joham djoham at yahoo.com
Thu Apr 3 05:29:12 BST 2003


Found the problem...

In HM_ScriptDOM.js, there's a call to the removeAttribute method of a newly created DOM object.
This call is failing in Konq with a "DOM Exception 8" error for some reason.

This call seems to fail whenever you call it in Konqueror regardless of whether or not the DOM
object was in the HTML or created via JavaScript. Putting a try/catch around this one line of code
made the menus work with one visual glitch that's new since the last time I looked at these menus.
Nothing major at all, the menus are fully functional.

I've created a small recreation that demonstrates the problem. Debugging Konq's code is beyond my
C++ skills so I'll have to pass this off to someone more qualified at this point. I did take a
quick look at the CVS commit logs for any file that had removeAttribute in it under kdelibs/khtml,
but nothing jumped out at me as an obvious culprit...

<<recreation>>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
<title>
HM Konq test</title>
</style>
</head>
<body>
<form action="none" method="get">
	<div>
		<input id="id" type="button" onclick="go()" value="click me" />
	</div>

</form>

<script type="text/javascript">

function go() {

	var img = document.createElement("img");
	try {
		img.removeAttribute("height");
	}
	catch (e) {
		alert(e);
	}
	alert("done with first");
	
	var x = document.getElementById("id");
	try {
		x.removeAttribute("height");
	}
	catch (e) {
		alert(e);
	}
	alert("done with second");
	

}

</script>
</body>
</html>

Hope this helps you get back on track George...

David


--- George Staikos <staikos at kde.org> wrote:
> On April 2, 2003 00:46, David Joham wrote:
> > Well that's interesting. I was under the impression that even if you did
> > spoof the UA, Konq wouldn't work in any version of HM below 4.2.3. I just
> > tried a UA of "IE 5.5" on the site with Konq 3.1 and the menus came right
> > up. Nifty!
> 
>   Yes I did use this site for quite some time with 3.1.
> 
> > I'm compiling HEAD right now. I'll try to take a look at the code and where
> > its dying tomorrow night after it's finished. Have you tried looking at the
> > code with the new JS debugger?
> 
>     I did try, but the JS debugger seems to be a bit flaky for me.  And to be 
> honest, I'm not sure it always works.  I don't have much time to look into 
> this until later this week anyways.
> 
> > btw: I'll bite. Why was your talk canceled?
> 
>     Officially I don't really know (I can only guess), but a lot of clues and 
> previous events point to certain things. See: 
> http://lists.kde.org/?l=kde-promo&m=104915592612090&w=2
> 
> -- 
> George Staikos
>  ...  Yes, my KDE talk at Real World Linux was cancelled on me.

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com




More information about the kfm-devel mailing list