On Jul 12, 2006, at 6:06 PM, .M. wrote:
> > > Bob Ippolito wrote: >> When you use connect on a DOM element you get the *event object* as >> the first argument. The show function doesn't work because you're >> passing an event object instead of a DOM element or identifier. Any >> of the signal examples or documentation should've made this pretty >> clear. Do you remember why you thought "e" would be the element? What >> changes can we make to the documentation so that someone else won't >> do this? > > Cheers Bob > > By passing a string to the function I thought the function might > auto-convert to an element reference, like (getElement('myID'). That's what it does do, but that doesn't change the fact that the signal handler gets called with the event object. > On > http://mochikit.com/doc/html/MochiKit/Signal.html > > The connect doco says "'src is the object that has the signal" so I > assumed the object I called "souruce_1" was the DIV labelled with id > "source_1" and that this was being passed. That is what it does. > Maybe, if I've got this right, you should use a different variable > name > other than 'src' for the event object and specifically refer to the > event object. > > <code>"If func is undefined and dest is a function, then > func.apply(src, ...) will be called when the signal is > signalled."</code> I don't understand what you're trying to say here, but the docs are correct... >> In other words, you probably want: >> >> setElementClass(e.src(), "popup"); > > Now I'm getting "e.src is not a function". That's because your code is still wrong. You're *calling* the show and hide functions during the connect! I didn't see that the first time because it wrapped to the next line. Don't do that. This is your code: show = function(e) { setElementClass(e, 'popup'); } connect('source_1', 'onmouseover', show('source_popup_1')); This is what your code does: setElementClass('source_popup_1', 'popup'); connect('source_1', 'onmouseover', undefined); This is the code you want: var show_popup = function (element, e) { e.stop(); setElementClass(element, 'popup'); }; connect('source_1', 'onmouseover', partial(show_popup, 'source_popup_1')); -bob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MochiKit" group. To post to this group, send email to mochikit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit -~----------~----~----~----~------~----~------~--~---