On Dec 4, 5:58 am, Per Cederberg <p...@percederberg.net> wrote: > In your case, why wouldn't you just attach the signal when creating > the element? Otherwise you'd have to listen to any DOM modification > and possibly attach signals to elements added. And that use case > sounds pretty specific to me.
In the simple case, yes, I could just add the event when I create the DOM elements. However, my current project (Ruby on Rails with jQuery) does a lot of AJAX calls to pull in new bits of HTML. If I want to register for events for those DOM elements, it's easy with jQuery.live. jQuery has two ways to register for events $("selector").event(function (){}...) <--- "selector" must exist and $("selector").live('event', function(){}...) <-- "selector" can exist in the future, doesn't have to now It seemed to me that MochiKit.Signal.connect might be a more consistant way (aka: One Way To Do It) to do this, if the source didn't have to exist at time of connect. > BTW. If you'd like to contribute patches to the MochiKit project, it > would be much easier if you forked the project on GitHub I think. Thanks. I've seen mochikit on Github (and +2 for me: I've seen lots of activity lately, I think partially due to the Github move) Bob Ippolito said: > That said, I think jQuery Live style functionality is useful, and I > certainly wouldn't mind seeing some additional module to support it. That's what I'm thinking, actually: some kind of MochiKit.BetterSignal.connect that : (Python looking pseudo code ahead) if src exists: MochiKit.Signal.connect(src....) else: # add it to some list of DOM elements we are waiting for, and when the DOM changes we look for it That with some selector support from MochiKit.Selector might be get me where I want to go. Maybe I'll throw a few experiments together and push it to a GitHub repo. (I'll let the list know) Hope this helps, _Ryan Wilcox -- You received this message because you are subscribed to the Google Groups "MochiKit" group. To post to this group, send email to mochi...@googlegroups.com. To unsubscribe from this group, send email to mochikit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/mochikit?hl=en.