@kangax,
have a look here:

   http://javascript.nwbox.com/NWEvents/delegates.html

"focus/blur" events are simulated cross-browser but
transparently to the event setup by the programmer.

Of great note is that in the example no "onload/DOMReady"
event is used to bootstrap the functionality of the interface,
it just run as it loads, this is event delegation.

It uses a lengthy syntax that you surely don't like, but is very
compact and framework agnostic (so easy to port to your
preferred environment):

NW.appendDelegate(selector, event-type, handler, [delegate]);
NW.removeDelegate( ... , ... , ... );

But you are free to add your $ taste and extra saccharine.

In my code the "[delegated]" element is optional, in case you do not
specify the element the code will use the mighty "documentElement".
This is the HTML node which is omnipresent in all browsers, for sure
this also mostly avoid conflict with current work since nobody uses
it.

This was the result of this thread:

   http://peter.michaux.ca/article/3752

The "submit" is a pain for me too, but a couple of "mouseup/keyup"
events will do the trick without patching the library just for an IE
bug.

Would be great if you can confirm that speed is not a problem with
my approach, I can use this fine with mouseover/mouseout, for
mousemove I would have to enable some caching methods
that are included in NWMatcher, the faster "match()" method
you could see around. Promised  :-)

Diego Perini


On Feb 22, 8:32 pm, kangax <[EMAIL PROTECTED]> wrote:
> Protolicious is my personal repo for little snippets I use at work or
> play with : )
>
> You noticed right about main differences. My main concern was
> definitely a performance, therefore selector caching and plain loops.
> Another thing to note is that it accepts comma-separated selector
> expressions:
>
> Event.register('.confirmation abbr, .error abbr', 'click', showInfo);
>
> I'm not sure how important it is, but it also purges all the event
> handlers (attached internally) when page unloads.
>
> - kangax
>
> On Feb 22, 2:03 pm, Ken Snyder <[EMAIL PROTECTED]> wrote:
>
> > kangax wrote:
> > > Ken,
> > > take a look at my implementation [1] - it looks very much alike,
> > > except for the syntax : )
>
> > > [1]http://code.google.com/p/protolicious/source/browse/trunk/src/event.r...
>
> > > - kangax
>
> > Cool!  So if I understand it correctly, register() has three differences
> > from mine:
> > - register() registers all rules to the document
> > - register() caches the Selector objects (cool!)
> > - register() requires attaching one selector-handler pair at a time
>
> > So what is this protolicious?
>
> > I couldn't find any event delegation scripts on scripteka... is your
> > script in protolicious only?
>
> > - Ken
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to