Don't forget about the possibility to register a global ajax callback that enables automatic behaviours for newly inserted DOM elements.
YMMV if you're into JSON and/or dynamically generated DOM sections with the new Element(...) stuff or scripty's builder.js -- you'll probably want a recursive method that applies behaviours, something like: $('blah').applyBehaviours(); Or use wrap() to augment Element.update().... Or.... Prototype is sweet, and gets more sugar on the top all the time... :) Best, Thomas Am 03.05.2007 um 19:12 schrieb Mislav Marohnić: > On 5/3/07, snarkyFish <[EMAIL PROTECTED]> wrote: > > I've been using prototype and behaviour side by side for a while now. > I am rather new to prototype, but I've yet to find anything as simple > and clean as behaviour ( http://bennolan.com/behaviour/ ) for > associating an event to a css selector. > > Once, when we (the core guys) chatted working on the event branch, > I though of how easy it would be to re-implement Behaviour in > Prototype: > var Behaviour = { > register: function(obj) { > Event.onReady(function(){ for (sel in obj) $$(sel).each(obj[sel]) }) > } > } > Yeah, this is it. You only need Event.onReady() for this. You can > find it in the event branch or you can copy it over from LowPro. > Once Event.onReady() gets into trunk, these 3 lines will probably > be all you need. > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---