Re: [jquery-dev] Re: Event Delegation Plugin -- Needs feedback

2009-11-19 Thread Scott Sauyet
On Wed, Nov 18, 2009 at 8:22 PM, xwisdom wrote: > Thanks for the feedback. > >>     $(context).delegate('li:even, li:odd', 'click', callback) >>     $(context).delegate('li' 'click.namespace', callback) Actually, the more I think about it, the more I think that this is still more readable: $

[jquery-dev] Re: Event Delegation Plugin -- Needs feedback

2009-11-18 Thread xwisdom
Hi Scott, Thanks for the feedback. > $(context).delegate('li:even, li:odd', 'click', callback) > $(context).delegate('li' 'click.namespace', callback) I kind of like these formats but I'm thinking that things will get much more complicated if later on we should introduce a data parameter

[jquery-dev] Re: Event Delegation

2009-09-15 Thread tres
Hey Justin, Focus/blur event delegation has landed in trunk. Just as an outside perspective, you can check out what i've used for focus/blur delegation here: http://code.google.com/p/jquery-plugin-dev/source/browse/trunk/jquery.bond.js. Cheers, Trey On Sep 15, 2:31 pm, Justin Meyer wrote: > T

[jquery-dev] Re: Event Delegation

2009-09-14 Thread John Resig
Just a heads-up: Support for focus/blur has already landed in trunk (courtesy of Ariel) and support for submit is in the process of landing (courtesy of Yehuda). --John On Tue, Sep 15, 2009 at 12:31 AM, Justin Meyer wrote: > > That method doesn't work for focus. Focus doesn't bubble in IE, and

[jquery-dev] Re: Event Delegation

2009-09-14 Thread Justin Meyer
That method doesn't work for focus. Focus doesn't bubble in IE, and you have to use activate. I could check if activate is present and use that, but it's backwards. But it seems like this is what is done for XHR: return window.ActiveXObject ? new ActiveXObject("M

[jquery-dev] Re: Event Delegation

2009-09-14 Thread Justin Meyer
On Kangax's method: Perfect, thanks! I'm surprised that works. On 100s of delegates: Well 100s is an exaggeration, but I would guess about 200. There are about 40 different components, each responding to about 5 events. The components listen regardless if the component is in the page. Someone c

[jquery-dev] Re: Event Delegation

2009-09-14 Thread John Resig
> I'm not sure what to do about this. I'd like to make the special case > of live avoid: > > handlers[ handler.guid ] = handler; > > and instead do > > handlers['click'][ handler.guid ] = handler; > > Thoughts? I know you guys are busy, but I'd like to know that my work > might have a chance at b

[jquery-dev] Re: Event Delegation

2009-09-14 Thread John Resig
> Best way to listen and remove multiple events for a single delegated > event? (EX: delegate on submit, listen for keypress and click) > I recommend using special events - this is built in to jQuery core and it's precisely what it's used for (we were planning on using them to implement submit and

[jquery-dev] Re: Event Delegation

2009-09-14 Thread Justin Meyer
live.remove is going to have to get passed the stored guids instead of just counting the remaining 'submits'. On Sep 14, 5:41 pm, Justin Meyer wrote: > Another issue is that every live event is stored in $.data > ('events').live in a flat hash.  That means you have to iterate > through every liv

[jquery-dev] Re: Event Delegation

2009-09-14 Thread Justin Meyer
It seems like I need to be able to store multiple guids in guid. Would it be better to have it handle if guid is an array, or just add a guids property? On Sep 14, 5:41 pm, Justin Meyer wrote: > Another issue is that every live event is stored in $.data > ('events').live in a flat hash.  That me

[jquery-dev] Re: Event Delegation

2009-09-14 Thread Justin Meyer
Another issue is that every live event is stored in $.data ('events').live in a flat hash. That means you have to iterate through every live event handler instead of just doing something like $.data('events').live['click'] -> [list of all delegate selectors] which would be much faster, especially

[jquery-dev] Re: Event Delegation

2009-09-14 Thread Justin Meyer
The following avoids browser sniffing for IE's submit. It simply creates a div inside a form, then dispatches a submit event and sees if it bubbles. I'll see if something similar works for change in Safari and IE. jQuery(function(){ var sendEvent = function(type, element){

[jquery-dev] Re: Event delegation

2009-01-26 Thread John Resig
Justin - If I'm understanding you correctly you're concerned that stopPropagation doesn't work with live events - that is correct. We have a patch that we're working on to, potentially, provide a fix for this - we hope to land it soon! --John On Sun, Jan 25, 2009 at 11:13 PM, Justin Meyer wr

[jquery-dev] Re: Event delegation

2009-01-25 Thread Justin Meyer
So, I've started the process of converting to jQuery. But, I think there is a snag. I noticed that you can't cancel events. Is this on the horizon? In JMVC, I collect all the elements that respond to the event through delegation and order them. I dispatch each callback, but if the event's "ki

[jquery-dev] Re: Event delegation and cancelling click events

2008-12-30 Thread Kurt Mackey
Woo! -Original Message- From: jquery-dev@googlegroups.com [mailto:jquery-...@googlegroups.com] On Behalf Of John Resig Sent: Tuesday, December 30, 2008 2:47 PM To: jquery-dev@googlegroups.com Subject: [jquery-dev] Re: Event delegation and cancelling click events Fixed. http

[jquery-dev] Re: Event delegation and cancelling click events

2008-12-30 Thread John Resig
Fixed. http://dev.jquery.com/changeset/6013 --John On Tue, Dec 23, 2008 at 12:46 AM, John Resig wrote: > Yeah, I agree that this is not ideal - thanks for spotting it, I'll > look in to it. > > --John > > > > On Mon, Dec 22, 2008 at 4:48 PM, Kurt Mackey wrote: >> >> The event delegation stuf

[jquery-dev] Re: Event delegation

2008-12-24 Thread Dan G. Switzer, II
Justin, > I listen for click instead of change. I check if it is on a SELECT > element. If it is, I check to see if its value has changed after each > click. I don't think using capture instead of bubbling will help. Just be aware that you're also need to then check for keypress as well--for

[jquery-dev] Re: Event delegation

2008-12-24 Thread Justin Meyer
Change in IE: I listen for click instead of change. I check if it is on a SELECT element. If it is, I check to see if its value has changed after each click. I don't think using capture instead of bubbling will help. Change in webkit Listen for change, but I think it is called even if someon

[jquery-dev] Re: Event delegation and cancelling click events

2008-12-22 Thread John Resig
Yeah, I agree that this is not ideal - thanks for spotting it, I'll look in to it. --John On Mon, Dec 22, 2008 at 4:48 PM, Kurt Mackey wrote: > > The event delegation stuff in jQuery seems extra tasty, particularly when you > have to deal with ghetto ad code written in the previous century.

[jquery-dev] Re: Event delegation

2008-12-22 Thread Elijah Insua
Thank you, I just moved cross country and have been really busy. Apparently I missed these Sent from my iPhone On Dec 22, 2008, at 9:54 PM, "Richard D. Worth" wrote: > > On Mon, Dec 22, 2008 at 6:48 PM, Elijah Insua > wrote: > > This list? I must be blind. My appologies > > Here are som

[jquery-dev] Re: Event delegation

2008-12-22 Thread Richard D. Worth
On Mon, Dec 22, 2008 at 6:48 PM, Elijah Insua wrote: > > This list? I must be blind. My appologies Here are some related threads: Someone has Safari 2 ? http://groups.google.com/group/jquery-dev/browse_thread/thread/6a4bf8a6344de44f Status of jQuery with Safari 2.0.4? http://groups.google.co

[jquery-dev] Re: Event delegation

2008-12-22 Thread Elijah Insua
This list? I must be blind. My appologies Sent from my iPhone On Dec 22, 2008, at 7:18 PM, "John Resig" wrote: > >> Dropping support? >> >> I'd like to be more involved with these types of decisions even if >> it's just being aware. Where do you guys discuss this stuff? > > We've been mentio

[jquery-dev] Re: Event delegation

2008-12-22 Thread John Resig
> Dropping support? > > I'd like to be more involved with these types of decisions even if > it's just being aware. Where do you guys discuss this stuff? We've been mentioning it on the list for a while now. Nearly all of the major libraries have already dropped support - at this point Safari 2.

[jquery-dev] Re: Event delegation

2008-12-22 Thread Elijah Insua
Dropping support? I'd like to be more involved with these types of decisions even if it's just being aware. Where do you guys discuss this stuff? Thanks -- Elijah Sent from my iPhone On Dec 22, 2008, at 6:38 PM, "Jörn Zaefferer" wrote: > Afaik we are dropping support for Safari 2, so tha

[jquery-dev] Re: Event delegation

2008-12-22 Thread Jörn Zaefferer
Afaik we are dropping support for Safari 2, so that could be simply removed. Jörn On Tue, Dec 23, 2008 at 12:15 AM, Klaus Hartl wrote: > > Yes, I wrote a fix for submit and reset, although quite rough and > never got around to improve it. Ariel already proposed refactored code > at that time. >

[jquery-dev] Re: Event delegation

2008-12-22 Thread Klaus Hartl
Yes, I wrote a fix for submit and reset, although quite rough and never got around to improve it. Ariel already proposed refactored code at that time. The most up-to-date version is probably the one from Plazes: http://plazes.com/javascripts/jquery.delegate.js Bit redundant code there as well as

[jquery-dev] Re: Event delegation

2008-12-22 Thread Jörn Zaefferer
To clarify, my delegation plugin handles focus/blur events, so far by providing special event handling for focusin/focusout in browsers that don't already support it (currently only IE). Though it should be easy to rewrite that to bind to focus and blur instead. I think Klaus Hartl had a different

[jquery-dev] Re: Event delegation

2008-12-22 Thread John Resig
The new .live() code is in trunk now. The submit/change fixes haven't landed yet but I was planning on integrating the code from Joern's delegation plugin (as he resolves the issues there). --John On Mon, Dec 22, 2008 at 12:57 PM, Justin Meyer wrote: > > jQuery developers, > I've heard that

[jquery-dev] Re: event delegation

2008-10-15 Thread Diego Perini
Mike, the points I tried to make above are not specific to your code (haven't tested it yet). For the ordering problem I was talking about the find() method, I understand you use a modified "is()" method that does some more powerful things in a more spec compliant way. NWMatcher has always done t

[jquery-dev] Re: event delegation

2008-10-15 Thread mike.helgeson
Diego, I do not understand what you are getting at, or what the issue is... The plugin I have provided does not have any dependency on document ordered or unordered nodes. When John's new selector engine (sizzle) is included in the core, perhaps the order of nodes may be different, but I don't se

[jquery-dev] Re: event delegation

2008-10-14 Thread Diego Perini
Mike, no, it is not about me or Matt or the others, that's how the CSS specs are already implemented in the browsers, or will soon be (Webkit leading the way). My selector engine is just a temporary path to enhance browsers still not having those capabilities (all but Safari currently !) and is op

[jquery-dev] Re: event delegation

2008-10-14 Thread mike.helgeson
Ariel, Perhaps I am just polluting the plugin universe with duplicate features, but part of the reason I created another plugin is because I learn by coding. When you have an idea, do you prefer to write it out yourself, or tell someone else to write it for you? I guess it depends on the idea, but

[jquery-dev] Re: event delegation

2008-10-11 Thread Diego Perini
Mike, what I normally need is let the CSS selector specify on what elements I want lo listen for event and not have that embedded by default (forced) in the plugins or core. For example I prefer to be able to fully use and specify CSS selector like these in the delegation method: '#nav' listenin

[jquery-dev] Re: event delegation

2008-10-11 Thread Jörn Zaefferer
About the delegation plugin used by the validation plugin: There an event bubbles from an input (always the event.target, inputs don't have children) to the form. So there was no need to find the actual delegate based on the event.target. Works well in this case, but isn't a general event delegatio

[jquery-dev] Re: event delegation

2008-10-10 Thread Matt
On Oct 10, 3:17 pm, Ariel Flesler <[EMAIL PROTECTED]> wrote: > So... it uses is()... I think your plugin is very very similar to > Intercept/Delegate, just adding the parent traversal. And I'm a little uncertain about how it differs from my event delegation code at: http://groups.google.com/group

[jquery-dev] Re: event delegation

2008-10-10 Thread Ariel Flesler
So... it uses is()... I think your plugin is very very similar to Intercept/Delegate, just adding the parent traversal. Listen already does that and maybe Delegate too. IMO this is just increasing the amount of plugins doing the same thing. I think adding that to any of the aforementioned plugins

[jquery-dev] Re: event delegation

2008-10-10 Thread mike.helgeson
So I put out a plugin today to acheive all of the goals stated previously: - Data, event data as is currently supported in the event system - Bubbling, starting with event.target, and traversing up the parent tree to match the delegate selector - Canceling default event behavior, parent tree-walk

[jquery-dev] Re: event delegation in core

2008-09-04 Thread Michael Geary
Which delegation plugin are you referring to? I see several different ones with different styles of API. Thanks, -Mike _ From: John Resig Working with the plugin would probably be fine - since the final delegation API will probably be similar to it. --John On Wed, Sep 3, 2008 a

[jquery-dev] Re: event delegation in core

2008-09-04 Thread John Resig
Working with the plugin would probably be fine - since the final delegation API will probably be similar to it. --John On Wed, Sep 3, 2008 at 11:09 PM, chris thatcher < [EMAIL PROTECTED]> wrote: > So I'm a big dummy, no news there, but I did finally understand the > difference between event for