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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to