really the invoke calls are only necessary because i wanted to modify the behavior of the events a little bit. i think to exactly emulate mouseenter and mouseleave you don't need to do any of the ancestor calculation and you only have to observe stopEvent on the element you fire the custom event on (to or from) to stop bubbling up beyond them? also, i'm not getting errors over the input elements on firefox.
either way it definitely puts undo strain on the browser and getting the patch into core is definitely the way to go, i just decided to see if i could do it with custom events when i needed it a couple weeks ago, saw the possibility posted a few places, but could not find an implementation. walter, custom events are used by dispatching them via the fire method of extended elements. if you look at the source on the link above you will see the code which does this. the basic idea is to observe the mouseout event on the document since all other mouseout events will bubble up to there. the mouseout observer uses properties of the event object to determine the element the mouse came from and the element the mouse moved to. if the relationship between these two elements suites certain conditions the custom events 'custom:mouseenter' and 'custom:mouseleave' are fired. the only part that was tricky was making sure the events don't bubble past where they should, which is accomplished by attaching an observer that stops propagation of the event on certain elements before the event is fired, and unattaching it afterward. to catch these events you can use Event.observe as usual (see the Event.observe('dom:loaded') in the source). http://andrewdupont.net/2007/11/07/pseudo-custom-events-in-prototype-16/ helped me out a lot if you want more info. On Oct 1, 5:37 pm, Nick Stakenburg <[EMAIL PROTECTED]> wrote: > On 1 okt, 19:15, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > here's a version that uses custom > > events:http://neverninetofive.com/mouseenterleave/ > > Calling invoke('observe') and invoke('stopObserving') like that is > overkill. The patch I've posted is much easier on the browser since it > observes what's needed only once. It also doesn't errors on Firefox > when you mouseover the input elements. > > Custom events are not the best way to implement this since custom > events bubble. See the Lighthouse ticket for more > detailshttp://prototype.lighthouseapp.com/projects/8886/tickets/350 > > -- > Nick --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---