From: Kirk R. H. <kh...@qu...> - 2001-01-23 23:22:16
|
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 kh...@qu... 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 =3D e.target; } else { // For Internet Explorer we want to find the element type that has = been associated with a=20 // 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 =3D event.srcElement; while(par !=3D null && par.lyrobj =3D=3D null) par =3D = par.parentElement; realsrc =3D (par =3D=3D null)?event.srcElement:par; =20 // Cache the dynLayer at the original element for faster access if(par !=3D null) event.srcElement.lyrobj =3D par.lyrobj; } _______________________________________________ Previous Code _________________________________________________ var realsrc=3Dis.ie ? e.srcElement:e.target var which=3D(is.ie||is.ns5)?e.button:e.which |