Bug 111568 - event handlers in DOM don't work
Summary: event handlers in DOM don't work
Alias: None
Product: konqueror
Classification: Applications
Component: khtml ecma (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
Depends on:
Reported: 2005-08-26 17:52 UTC by Jiri Palecek
Modified: 2008-03-14 19:58 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:

A testcase (985 bytes, text/html)
2005-09-05 15:47 UTC, Sébastien CRAMATTE

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Palecek 2005-08-26 17:52:53 UTC
Version:            (using KDE KDE 3.3.1)
Installed from:    Debian testing/unstable PackagesDebian testing/unstable Packages
OS:                Linux

The problem is with event listeners - they don't get correct "this" or
object data. For example the code

function handle(e)

var x=document.getElementById('something');

doesn't work for me. Although the menthod handle gets called,
there is an error on Javascript console saying that "this" doesn't
have property "aaa". In the JS debugger, this seems to be the currentTarget
element instead of the registered listener.
Comment 1 Sébastien CRAMATTE 2005-09-05 15:47:13 UTC
Created attachment 12481 [details]
A testcase
Comment 2 Sébastien CRAMATTE 2005-09-05 15:49:49 UTC
I've developp a full xforms 1.1 engine in javascript. And this bug hang my software. I use a lot of OOP and DOM events.
Comment 3 Harri Porten 2005-09-17 10:16:31 UTC
<input id="something" type="checkbox"></input>

function handle(e) 
var x=document.getElementById('something'); 
Comment 4 Maksim Orlovich 2008-03-14 19:53:13 UTC
SVN commit 785693 by orlovich:

Apply a patch from Vyacheslav Tokarev (username tsjoker, hostname gmail, tld com)
that fixes multiple issues with event listeners:

1. Use the proper 'this' object for object-style event listeners.
2. Use the object, not function, for comparison of object-style
event listeners
3. Properly keep html-style and normal listener objects separate ---
they behave independent, even if they wrap the same function,
and of course have different event-cancellation semantics


 M  +12 -8     kjs_events.cpp  
 M  +2 -2      kjs_events.h  
 M  +6 -6      kjs_window.cpp  
 M  +1 -1      kjs_window.h  

WebSVN link: http://websvn.kde.org/?view=rev&revision=785693
Comment 5 Maksim Orlovich 2008-03-14 19:58:09 UTC
SVN commit 785698 by orlovich:

Regression tests for event listener changes...

 A             baseline/events/dom-style-event.html-dom  
 AM            baseline/events/dom-style-event.html-dump.png  
 A             baseline/events/dom-style-event.html-render  
 A             baseline/events/two-listener-kinds.html-dom  
 AM            baseline/events/two-listener-kinds.html-dump.png  
 A             baseline/events/two-listener-kinds.html-render  
 A             baseline/events/two-listener-kinds2.html-dom  
 AM            baseline/events/two-listener-kinds2.html-dump.png  
 A             baseline/events/two-listener-kinds2.html-render  
 A             tests/events/dom-style-event.html  
 A             tests/events/two-listener-kinds.html  
 A             tests/events/two-listener-kinds2.html  

WebSVN link: http://websvn.kde.org/?view=rev&revision=785698