Summary: | window.addEventListener("load", ...) and document.addEventListener("load", ...) do not work | ||
---|---|---|---|
Product: | [Applications] konqueror | Reporter: | Jesse Pelton <jsp> |
Component: | khtml ecma | Assignee: | Konqueror Developers <konq-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | tdd |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: |
test case
Testcase for window.addEventListener, similar to the one above |
Description
Jesse Pelton
2003-04-30 20:29:15 UTC
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. |