From: Jordi 'I. M. <jmi...@or...> - 2001-01-11 10:38:19
|
I have updated CVS with a new events.js that should fix IEs event problems. All the example files worked fine. This is what happened ( at least this is something I found, maybe there are still other issues ): - All browser events in DynAPI are captured and passed to the same EventMethod. This eventMethod identifyes the physical layer, cancels browser event, searches for the appropiate DynmLayer object and invokes its event. - In IE, in order to access the DynLayer object we use the lyrobj property of the DIV itself. This property is set when creating a layer so from code executed within the DIV's scope we can still get to our DynLayer obj. The problem with our contents was that when clicking on a text, most of the times the srcElement of the event was not the DIV but a FONT, TD, TR, TABLE, UL,... element. That element did not have a pointer to the dynlayer and thus the API could not route the event properly. - This issue was partially solved for images by doing: if (is.ie) for (i in dlyr.elm.all.tags("img")) dlyr.elm.all.tags("img")[i].lyrobj=dlyr; So images had a pointer to the layer aswell. This we would have needed to do to all elements in our content, somethig really painful. Instead, I added this line inside eventmethod. for(;is.ie && !realsrc.lyrobj && realsrc.parentElement && realsrc.parentElement!=realsrc;realsrc=realsrc.parentElement); Which actually makes realsrc travel IE's object hierarchy until we find the lyrobj reference. By doing so I fixed events in IE5 and 5.5. I'm not that sure everything is fine now, but it is an improvement. There are several lines in that method such as that if (e.type=="mouseover" || e.type=="mouseout") return false; just before the bubbleEvent() call that I don't understand but I prefer not to touch them. By the way, it seems that when clicking on a selectable text, NS does not fire a click event. Mousedown and mouseup are fired, but click isn't. We could fire it manually but then when clicking outside a text we would get two onclicks. Tell me if I broke something. Sure I did. Cya |