|
While trying out the dynapi I was having some
issues with Internet Explorer 5 and mouse event handling so I dug through the
code and made some alterations to events.jsp. I figured that I would pass them
on to this mailing list in case the changes I made could be useful to any one
else. Since I do not subscribe to this list myself, if anyone wants to discuss
my changes, please feel free to email me at [EMAIL PROTECTED]
The changes are as follows:
in the DynLayer.prototype.EventMethod I added the
following code to determine which dynAPI layer was associated with the mouse
event. The reason for this code is that a layer which contains other elements
that can respond to the mouse events will receive a mouse event through the IE
event bubbling paradigm where the events srcElement will not be equal to the
layer itself but to its subcomponent such as a <TD> element or a
<FONT> element, therefore, in order to find the appropriate dynLayer
object to associated the mouse event with, you must search through the
srcElements object hierarchy to find a dynLayer. That is what the following code
does. I put this code right under the current is.ie block in the
DynLayer.prototype.EventMethod
Kirk Hill
Quai, Inc.
_______________________________________________
New Code
_________________________________________________
var realsrc;
if(! is.ie) {
realsrc = e.target; } else { // For Internet Explorer we want to find the element type that has been associated with a // dynLayer object, therefore, we will look up through the object // hierarchy until we find an element that has an associated dynLayer. // If that element is not found then we will just pass the original source // element and the code later on will pick dyndoc as the dynAPI object // which is the target of this event. var par = event.srcElement; while(par != null && par.lyrobj == null) par = par.parentElement; realsrc = (par == null)?event.srcElement:par; // Cache the dynLayer at the original element for faster access if(par != null) event.srcElement.lyrobj = par.lyrobj; } _______________________________________________
Previous Code
_________________________________________________
var realsrc=is.ie ?
e.srcElement:e.target
var which=(is.ie||is.ns5)?e.button:e.which |
