handleEvent DOM API breakage

Darin Adler darin at apple.com
Fri Oct 17 19:28:58 CEST 2003


On Oct 17, 2003, at 6:16 PM, Dirk Mueller wrote:

> it seems you added a second, nonstandard parameter to this handler. 
> Thats both binary incompatible and a bug compared to the DOM spec.

Those are both good points.

I made this change over six months ago. It's really hard to remember 
the details, but luckily I can remember the most important bits. At the 
time I did it, I don't think I understood well the role of 
dom2_events.h, and the fact that it was public DOM API. But I do 
understand that well know.

> Why did you do that? Is there no better way ?

I was fixing a bug with an element that looked like this:

     <body onLoad="this.document.myForm.submit();">

The value of "this" was the document in KHTML, but the window in other 
browsers. My analysis, perhaps incorrect, was that in 
DocumentImpl::defaultEventHandler we need to make sure that 
JavaScript event listeners get the window, but in 
NodeImpl::handleLocalEvents we need to make sure that JavaScript 
event listeners get the target from the event.

Now that I see the problem with the way I did it, I can think of other 
solutions. Perhaps we can put an "is window event" flag in the 
EventImpl instead of passing a parameter. Maybe you have some ideas 
about other even better ways to fix the problem.

     -- Darin



More information about the Khtml-devel mailing list