Bug 64702 - document.appendChild does not work with img
Summary: document.appendChild does not work with img
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml ecma (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-22 00:41 UTC by Jos van den Oever
Modified: 2005-08-10 02:27 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
file showing the bug (708 bytes, text/html)
2003-09-23 15:06 UTC, Jos van den Oever
Details
html with image that resizes with browser window (2.85 KB, text/html)
2003-11-01 23:03 UTC, Jos van den Oever
Details
html with image that resizes with browser window (2.85 KB, text/html)
2003-11-01 23:12 UTC, Jos van den Oever
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jos van den Oever 2003-09-22 00:41:13 UTC
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.
Comment 1 Jos van den Oever 2003-09-23 15:06:15 UTC
Created attachment 2556 [details]
file showing the bug
Comment 2 Jos van den Oever 2003-09-30 13:20:58 UTC
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. 
 
 
Comment 3 Luís Pedro Coelho 2003-10-18 00:42:39 UTC
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
Comment 4 Jos van den Oever 2003-11-01 23:03:12 UTC
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.
Comment 5 Jos van den Oever 2003-11-01 23:12:05 UTC
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.
Comment 6 Jos van den Oever 2004-05-11 09:41:27 UTC
This bug is still present in KDE 3.2.1.
Comment 7 Jos van den Oever 2004-09-09 11:42:08 UTC
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 
 ------
Comment 8 Jos van den Oever 2004-12-10 15:51:50 UTC
Confirming the bug in Konqueror 3.3.2.
Comment 9 Paul Temple 2005-02-08 03:07:57 UTC
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.
Comment 10 Maksim Orlovich 2005-08-10 02:27:24 UTC
Fixed with:http://lists.kde.org/?l=kde-commits&m=112363300719573&w=2