Version: (using KDE Devel) Installed from: Compiled sources Compiler: gcc version 3.2.3 (Debian) OS: Linux For a nice image gallery page, I'd like to add an <img> to a document. The method document.appendChild works well with both Mozilla and Opera. Konqueror old and recent, do not work with this function. I've added an example, that should add an image each time the page is resized.
Created attachment 2556 [details] file showing the bug
When one views this page with javascript "Report errors" turned on, the following error is reported when the page is resized: ----- An error occurrred while attempting to run a script on this page. http://bugs.kde.org/attachment.cgi?id=2556&action=view line 15: Error: DOM Exception 8 ------ The number 8 corresponds to the DOM Error NOT_FOUND_ERR (according to kdelibs/ khtml/dom/dom_exception.h. I don't know what this means.
function newimage() { newimg = new Image; newimg.src = 'thumbs/20030828182016.jpg'; newimg.alt = "image"; // newimg.setAttribute('width', '100px'); // newimg.setAttribute('height', '100px'); var div = document.getElementById('main'); div.appendChild(newimg); return false; } Is it just me or isn't appendChild supposed to take a Node created by the corresponding document? I don't know what an Image is, BTW. I tried searching through the javascript docs at msdn + google and I didn't find it. regards, luis
Created attachment 2973 [details] html with image that resizes with browser window This file shows the mentioned bug in an html file that is used in galleries. The JavaScript in the page resizes the image so that it always fits the window. This file works well in recent versions of Mozilla, IE and Opera.
Created attachment 2974 [details] html with image that resizes with browser window This file shows the mentioned bug in an html file that is used in galleries. The JavaScript in the page resizes the image so that it always fits the window. This file works well in recent versions of Mozilla, IE and Opera.
This bug is still present in KDE 3.2.1.
Attachment 2974 [details] still does not work in Konqueror 3.3. The error message is still the same: ----- An error occurrred while attempting to run a script on this page. http://bugs.kde.org/attachment.cgi?id=2556&action=view line 15: Error: DOM Exception 8 ------
Confirming the bug in Konqueror 3.3.2.
As a workaround until that bug is fixed, you can replace the line newimg = new Image; with newimg = document.createElement('img'); That does the same and it's standards compliant, too.
Fixed with:http://lists.kde.org/?l=kde-commits&m=112363300719573&w=2