Version: (using KDE KDE 3.1.1) Installed from: Unlisted Binary Package OS: Linux Summary: Konqueror fails to fire document and window load events established with addEventListener(). Demonstration: Load the attached page. It has two load event handlers for the window and two for the document. For each object, the first handler is established with a call to addEventListener(), the second by setting the onload property. The second window event handler gets run, but the others do not. Additional information: - Mozilla calls the window load handlers but not the document load handlers. - IE 6.0 does not support the DOM event model, so this test case fails. - Opera 7.0 recognizes document.addEventListener but not window.addEventListener. The DOM2 event spec is vague about what objects should support the load event, so it's not surprising that different browsers implement it differently. I can deal with Mozilla's behavior (I only need one load event, and the window load event works just fine) and Opera's (because I can test for the value of window.addEventListener and use onload if it's null). Konqueror's behavior is problematic, because while window.addEventListener is a function, it doesn't have the desired effect.
Created attachment 1464 [details] test case
Forgot to mention: I'm primarily a Windows developer, and I don't have a Linux box to test with, so I'm running Knoppix from a CD. I realize that this isn't the absolutely most recent version of KDE, but it's recent (3.1.1), I've noticed the behavior in previous releases, and I can't find any closed bugs that appear similar.
Created attachment 2728 [details] Testcase for window.addEventListener, similar to the one above The current implementation of the <code>addEventListener</code> method (in kjs_window.ccp) shows that the events are added to the <code>body</code>, which does not exist in the <code>HEAD</code>: <pre> 01437 case Window::AddEventListener: { 01438 JSEventListener *listener = Window::retrieveActive(exec)->getJSEventListener(args[1]); 01439 DOM::Document doc = part->document(); 01440 if (doc.isHTMLDocument()) { 01441 DOM::HTMLDocument htmlDoc = doc; 01442 htmlDoc.body().addEventListener(args[0].toString(exec).string(),listener,args[2].toBoolean(exec)); 01443 } 01444 else 01445 doc.addEventListener(args[0].toString(exec).string(),listener,args[2].toBoolean(exec)); 01446 return Undefined(); 01447 } </pre> (Remark: Testing showed that it works in Safari and Mozilla [one could argue that it is not specified, but it would be really nice to have a unique event implementation]!) Stefan
Since this works in Safari (as I have confirmed), code exists somewhere to make this work as expected. Maybe Apple needs a little nudge...? Does anyone who voted for this bug have permission to change its status to NEW? Presumably you've encountered the same problem, so UNCONFIRMED seems inappropriate.
Still broken in 3.2.2.
The issue exists on Konqueror 3.3 on KDE 3.3 (Debian testing/unstable packages). As a side note, the W3C DOM Level 2 Events spec is indeed unclear about whether it applies to window, document or both (it does apply to "object" elements, too). As per Mozilla/Opera implementation, it works on window, not document. Either there still is this inadequate mapping to the body element (which makes no sense whatsoever, since lots of resources could be loaded from the HEAD anyway), or this is something else entirely. Note that I did not get a problem when adding listeners to other events than "load" for the window element.
*** This bug has been confirmed by popular vote. ***
Still broken in 3.3.
This one seems to work in HEAD, I get 4 messageboxes for the first testcase, and 2 for the second one.
Fixed by a recent commit by coolo
Works for me with 3.3.2. As far as I'm concerned, this bug can be closed.