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) { alert(this.aaa); } var x=document.getElementById('something'); x.addEventListener("change",{handleEvent:handle,aaa:"Ok"},false); 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.
Created attachment 12481 [details] A testcase
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.
<form> <input id="something" type="checkbox"></input> <script> function handle(e) { alert(this.aaa); } var x=document.getElementById('something'); x.addEventListener("change",{handleEvent:handle,aaa:"Ok"},false);
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 BUG:147249 BUG:111568 BUG:128416 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
SVN commit 785698 by orlovich: Regression tests for event listener changes... CCBUG:147249 CCBUG:111568 CCBUG:128416 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