From: Jordi 'I. M. <jmi...@or...> - 2001-01-11 19:21:36
|
OK. This is the status of the events: I think they all work now but there is one case: imagine layer a, layerb child of a and layer c child of b. All children are 0,0 placed so there's a common corner. Now do a mouseover on that corner. What happens ? IE sends the mouseover event only to the upper-most layer, that's 'c'. Then the API kicks in and bubbles it if you allowed it to bubble. Everything works as expected. Now let's see what does netscape do: well all layers receive their own mouseover event. It makes sense somehow because all layers were enetered by the mouse. Having this in mind, the EventMethod does not bubble mouseover and mouseouts in NS because they will already be sent to the other layers, then introciing this line at the end of Eventmethod (just before bubbling): if (is.ns && (e.type=="mouseover" || e.type=="mouseout")) return false; That is.ns was introduced by me because it was blocking IEs events (remember rollovers not happening in some menu widgets ? ) But the events are received by layers from parent to child, not child to parent as we'd want. Therefore mouseovers work in a different way IE-NS. What we should do is cancel a parent's mouseovers-mouseouts if we detect that that same event affected one childlayer and have the child most inside of the hierarchy that received that mouseover execute it and bubble it up. I'm braindead, maybe tommorrow. I'll update CVS with what I have so far. Use at your own risk but it should be the best version to date. PS: I understood those lines: if (e.type=="mouseout" && this.contains(e.toElement)) return true; if (e.type=="mouseover" && this.contains(e.fromElement)) return true; They must be there. Jordi 'IlMaestro' Ministral wrote: > Ok, eventlisteners can be added before layer creation again. Looks that I got IE5.5 to obey me as a marine, ( yes > sir i'm a piece o'shit sir !! ) and now I only need to fix some stupid NS issues. Maybe I did cause some of these > errors myself while fixing others but anyway. > > I'm commented out these lines: > > if (e.type=="mouseout" && this.contains(e.toElement)) return true; > if (e.type=="mouseover" && this.contains(e.fromElement)) { return true; } > > which were causing trouble. If they need to be there please the author tell me why. I can't think of any > circunstance where they should be in there. > > Jordi 'IlMaestro' Ministral wrote: > > > I think I'm almost there this time. The fix I posted on CVS was OK, but was not enought. It seems that adding > > a listener before the layer is added to the document causes mouseover events to get lost. Click events work, > > though. > > > > Weird as usual > > > > Jordi 'IlMaestro' Ministral wrote: > > > > > I'm discovering lots of things about the event model now that we have the precreation code. I don't really > > > know if it has always been the same but I never realized. > > > > > > If you could just have a little patience I think I can beat it. > > > > > > Jordi 'IlMaestro' Ministral wrote: > > > > > > > I'm missing events... did I screw something ? First I thought but then going back to the latest code ( > > > > before my modifications ) I am missing those same events. Ohh please just a little luck from time to > > > > time !!!!! > > > > > > > > In NS you can apply the same "for (each image in doc) img.lyrobj = myself" event trick to the links > > > > array. > > > > > > > > Jordi 'IlMaestro' Ministral wrote: > > > > > > > > > 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 > > > > > > > > > > _______________________________________________ > > > > > Dynapi-Dev mailing list > > > > > Dyn...@li... > > > > > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev > > > > > > > > _______________________________________________ > > > > Dynapi-Dev mailing list > > > > Dyn...@li... > > > > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev > > > > > > _______________________________________________ > > > Dynapi-Dev mailing list > > > Dyn...@li... > > > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev > > > > _______________________________________________ > > Dynapi-Dev mailing list > > Dyn...@li... > > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev > > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev |