jQuery: The Write Less, Do More JavaScript Library

Will the live() method be improved in 1.4?

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

Will the live() method be improved in 1.4?

by xwisdom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

Just wondering if version 1.4 will include improvements to live()
events.

See example here:
http://www.zachleat.com/web/2009/05/08/performance-caveat-with-jquery-selectors-and-live-events/

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.



Re: Will the live() method be improved in 1.4?

by John Resig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, 1.4 will include improvements to the live event.

Specifically though this blog post is discussing the ability to not
run the initial selector if all you're doing is binding a live event
(they proposed a $.live). It's not clear if we'll be landing this
specific functionality in jQuery 1.4.

--John



On Thu, Nov 5, 2009 at 2:44 AM, xwisdom <xwisdom@...> wrote:

> Hello,
>
> Just wondering if version 1.4 will include improvements to live()
> events.
>
> See example here:
> http://www.zachleat.com/web/2009/05/08/performance-caveat-with-jquery-selectors-and-live-events/
>
> --
>
> You received this message because you are subscribed to the Google Groups "jQuery Development" group.
> To post to this group, send email to jquery-dev@....
> To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
> For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.



Re: Will the live() method be improved in 1.4?

by xwisdom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi John,

Thanks for the quick feedback

IMO, I think it would be handy to have something like $.live as I can
see where it would be of great benefit when working with a lot of
elements.

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.



Re: Re: Will the live() method be improved in 1.4?

by Nik Pasaran :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What about something like this:

    $.live = function(selector, type, callback) {
        $.fn.live.call({ selector: selector }, type, callback);
    }


On Thu, Nov 5, 2009 at 7:13 AM, xwisdom <xwisdom@...> wrote:

> Hi John,
>
> Thanks for the quick feedback
>
> IMO, I think it would be handy to have something like $.live as I can
> see where it would be of great benefit when working with a lot of
> elements.
>
> --
>
> You received this message because you are subscribed to the Google Groups "jQuery Development" group.
> To post to this group, send email to jquery-dev@....
> To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
> For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.



Re: Will the live() method be improved in 1.4?

by furf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've also been among those clamoring for an optimized $.live method
and have a offered similar hack around in the past <http://
blurf.furf.com/2009/09/jquery-live-from-new-york/> (via Paul Irish's
Anti-Patterns). Last night on the flight to jsconf, I hacked up a more
formal patch which puts optimized live and die methods into the jQuery
root and aliases them back to the jQuery instances.

http://github.com/furf/jquery-live/blob/master/jquery.live.js

Unless I'm missing something, I really haven't modified much and these
changes could be integrated into jQuery with two copies and two
pastes.

Hope that helps.

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.



Re: Will the live() method be improved in 1.4?

by Robert Katić :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I wonder why there would be an $.live with document as the only
interesting context.

Something like

  $(document).zombi(selector, type, ...)

would be more flexible (I know, "zombi" is not nice, but I have no
inspirations about a more suitable name).

To avoid to repeat selector on multiple bindings, I suggest something
like:

  $(document).make(selector)
    .zombi(type, ...)
    .zombi(type, ...)

An possible implementation of that: http://gist.github.com/227508

Maybe this is only a silly idea for majority of users (now), but I am
really of idea that this have even more sense then the current
$.fn.live.

On Nov 5, 2:44 am, xwisdom <xwis...@...> wrote:
> Hello,
>
> Just wondering if version 1.4 will include improvements to live()
> events.
>
> See example here:http://www.zachleat.com/web/2009/05/08/performance-caveat-with-jquery...

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.



Re: Will the live() method be improved in 1.4?

by Justin Meyer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

How about $("#something").delegate(".thing","click", func).

It almost makes too much sense :).

On Nov 5, 6:31 pm, Robert Katić <robert.ka...@...> wrote:

> I wonder why there would be an $.live with document as the only
> interesting context.
>
> Something like
>
>   $(document).zombi(selector, type, ...)
>
> would be more flexible (I know, "zombi" is not nice, but I have no
> inspirations about a more suitable name).
>
> To avoid to repeat selector on multiple bindings, I suggest something
> like:
>
>   $(document).make(selector)
>     .zombi(type, ...)
>     .zombi(type, ...)
>
> An possible implementation of that:http://gist.github.com/227508
>
> Maybe this is only a silly idea for majority of users (now), but I am
> really of idea that this have even more sense then the current
> $.fn.live.
>
> On Nov 5, 2:44 am, xwisdom <xwis...@...> wrote:
>
>
>
> > Hello,
>
> > Just wondering if version 1.4 will include improvements to live()
> > events.
>
> > See example here:http://www.zachleat.com/web/2009/05/08/performance-caveat-with-jquery...

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.



Re: Re: Will the live() method be improved in 1.4?

by Robert Katić :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Meyer, "delegate" was my first candidate too but I was worry that it  
was overused :). Seams that I was wrong. Will update it with  
"delegate" ASAP.

--Robert

On 6. stu. 2009., at 02:42, Justin Meyer <justinbmeyer@...> wrote:

> How about $("#something").delegate(".thing","click", func).
>
> It almost makes too much sense :).
>
> On Nov 5, 6:31 pm, Robert Katić <robert.ka...@...> wrote:
>> I wonder why there would be an $.live with document as the only
>> interesting context.
>>
>> Something like
>>
>>   $(document).zombi(selector, type, ...)
>>
>> would be more flexible (I know, "zombi" is not nice, but I have no
>> inspirations about a more suitable name).
>>
>> To avoid to repeat selector on multiple bindings, I suggest something
>> like:
>>
>>   $(document).make(selector)
>>     .zombi(type, ...)
>>     .zombi(type, ...)
>>
>> An possible implementation of that:http://gist.github.com/227508
>>
>> Maybe this is only a silly idea for majority of users (now), but I am
>> really of idea that this have even more sense then the current
>> $.fn.live.
>>
>> On Nov 5, 2:44 am, xwisdom <xwis...@...> wrote:
>>
>>
>>
>>> Hello,
>>
>>> Just wondering if version 1.4 will include improvements to live()
>>> events.
>>
>>> See example here:http://www.zachleat.com/web/2009/05/08/ 
>>> performance-caveat-with-jquery...
>
> --
>
> You received this message because you are subscribed to the Google  
> Groups "jQuery Development" group.
> To post to this group, send email to jquery-dev@....
> To unsubscribe from this group, send email to jquery-dev+unsubscribe@...
> .
> For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en 
> .
>
>

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.



Re: Will the live() method be improved in 1.4?

by furf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I don't think that the method name is at question here, but rather the
unnecessary performance cost of querying a selector before DOMReady
(or even after), ie. $('#anything'), when it is not needed for the
event delegation pattern. The .live method uses only the .selector
property of the jQuery instance and not the actual collection of DOM
elements, so there is no reason to query the DOM, especially before it
is even available.

Also, @robert, my solution supports the following notation, similar to
yours but using the familiar jQuery syntax (before/after DOMReady):
$.live("#mySelector", "click", fn1)
  .live("#mySelector", "mouseover", fn2)
  ...;

as well as (after DOMReady):
$("#mySelector").css("color", "#ff0000")
  .live("click", fn1)
  .live("mouseover", fn2);

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.



Re: Re: Will the live() method be improved in 1.4?

by John Resig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> Also, @robert, my solution supports the following notation, similar to
> yours but using the familiar jQuery syntax (before/after DOMReady):
> $.live("#mySelector", "click", fn1)
>  .live("#mySelector", "mouseover", fn2)
>  ...;

I understand the logic behind you wanting a $.live method (for the
edge cases where, presumably, you have hundreds or thousands of
elements that you're trying to match - and you don't want to run the
initial selector). Although there's a lot that I don't like about it:
 - You are now passing in a selector to a non $(...) or .foo() method.
This goes against all the conventions that the library has - when you
interact with DOM elements, stay within the jQuery set.
 - The only case where this matters is in a fringe case (namely, only
when you use both a complicated selector AND run it in IE < 8, since
all other browsers are using querySelectorAll) - but the existence of
the method in jQuery would remove the need to ever use the one method
that everyone should use.
 - Presumably since you're in a situation where you're really caring
about performance - then why are you using .live to begin with?
Shouldn't you be binding lower in the document? This is why the
closest method was added, to make tasks like this even easier.

I would simply recommend: If you're in a situation where you're
starting with a critical number of elements on your page, enough to
ruin your pages' overall performance, then you should use a basic form
of event delegation, like so:

$("#someRootTable").click(function(e){
  $(e.target).closest("td.foo").each(function(){
    // Your code goes here.
  });
});

Which is really what you should be doing anyway (live method or not).

--John

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.



Re: Re: Will the live() method be improved in 1.4?

by Robert Katić :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

$("#someRootTable").delegate("td.foo", "click", function(e){
   // Your code goes here.
});

Would be easer and safer because the event will be handlet only by "td.foo" elements inside "#someRootTable".
   
--Robert

On 6. stu. 2009., at 04:56, John Resig <jeresig@...> wrote:

$("#someRootTable").click(function(e){
 $(e.target).closest("td.foo").each(function(){
   // Your code goes here.
 });
});

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.

Re: Re: Will the live() method be improved in 1.4?

by John Resig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If you want to limit, just do this (using the nightlies):

$("#someRootTable").click(function(e){
  $(e.target).closest("td.foo", this).each(function(){
     // Your code goes here.
  });
});

Still pretty simple and requires no additional functionality. I may
just write this up as an example and add it to the live and closest
docs.

--John



On Fri, Nov 6, 2009 at 5:22 AM, Robert Katić <robert.katic@...> wrote:

> $("#someRootTable").delegate("td.foo", "click", function(e){
>    // Your code goes here.
> });
> Would be easer and safer because the event will be handlet only by "td.foo"
> elements inside "#someRootTable".
>
> --Robert
> On 6. stu. 2009., at 04:56, John Resig <jeresig@...> wrote:
>
> $("#someRootTable").click(function(e){
>  $(e.target).closest("td.foo").each(function(){
>    // Your code goes here.
>  });
> });
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "jQuery Development" group.
> To post to this group, send email to jquery-dev@....
> To unsubscribe from this group, send email to
> jquery-dev+unsubscribe@....
> For more options, visit this group at
> http://groups.google.com/group/jquery-dev?hl=en.
>

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.



Re: Re: Will the live() method be improved in 1.4?

by Robert Katić :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I suppose you will need an "return false;" too at the end of the  
handler...

--Robert

On 6. stu. 2009., at 05:29, John Resig <jeresig@...> wrote:

> If you want to limit, just do this (using the nightlies):
>
> $("#someRootTable").click(function(e){
>  $(e.target).closest("td.foo", this).each(function(){
>     // Your code goes here.
>  });
> });
>
> Still pretty simple and requires no additional functionality. I may
> just write this up as an example and add it to the live and closest
> docs.
>
> --John
>
>
>
> On Fri, Nov 6, 2009 at 5:22 AM, Robert Katić <robert.katic@...
> > wrote:
>> $("#someRootTable").delegate("td.foo", "click", function(e){
>>    // Your code goes here.
>> });
>> Would be easer and safer because the event will be handlet only by  
>> "td.foo"
>> elements inside "#someRootTable".
>>
>> --Robert
>> On 6. stu. 2009., at 04:56, John Resig <jeresig@...> wrote:
>>
>> $("#someRootTable").click(function(e){
>>  $(e.target).closest("td.foo").each(function(){
>>    // Your code goes here.
>>  });
>> });
>>
>> --
>>
>> You received this message because you are subscribed to the Google  
>> Groups
>> "jQuery Development" group.
>> To post to this group, send email to jquery-dev@....
>> To unsubscribe from this group, send email to
>> jquery-dev+unsubscribe@....
>> For more options, visit this group at
>> http://groups.google.com/group/jquery-dev?hl=en.
>>
>
> --
>
> You received this message because you are subscribed to the Google  
> Groups "jQuery Development" group.
> To post to this group, send email to jquery-dev@....
> To unsubscribe from this group, send email to jquery-dev+unsubscribe@...
> .
> For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en 
> .
>
>

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.



Re: Re: Will the live() method be improved in 1.4?

by Robert Katić :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

No you will not. My Mistake

--Robert

On 6. stu. 2009., at 05:29, John Resig <jeresig@...> wrote:

> If you want to limit, just do this (using the nightlies):
>
> $("#someRootTable").click(function(e){
>  $(e.target).closest("td.foo", this).each(function(){
>     // Your code goes here.
>  });
> });
>
> Still pretty simple and requires no additional functionality. I may
> just write this up as an example and add it to the live and closest
> docs.
>
> --John
>
>
>
> On Fri, Nov 6, 2009 at 5:22 AM, Robert Katić <robert.katic@...
> > wrote:
>> $("#someRootTable").delegate("td.foo", "click", function(e){
>>    // Your code goes here.
>> });
>> Would be easer and safer because the event will be handlet only by  
>> "td.foo"
>> elements inside "#someRootTable".
>>
>> --Robert
>> On 6. stu. 2009., at 04:56, John Resig <jeresig@...> wrote:
>>
>> $("#someRootTable").click(function(e){
>>  $(e.target).closest("td.foo").each(function(){
>>    // Your code goes here.
>>  });
>> });
>>
>> --
>>
>> You received this message because you are subscribed to the Google  
>> Groups
>> "jQuery Development" group.
>> To post to this group, send email to jquery-dev@....
>> To unsubscribe from this group, send email to
>> jquery-dev+unsubscribe@....
>> For more options, visit this group at
>> http://groups.google.com/group/jquery-dev?hl=en.
>>
>
> --
>
> You received this message because you are subscribed to the Google  
> Groups "jQuery Development" group.
> To post to this group, send email to jquery-dev@....
> To unsubscribe from this group, send email to jquery-dev+unsubscribe@...
> .
> For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en 
> .
>
>

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.



Re: Will the live() method be improved in 1.4?

by Robert Katić :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Regarding improving live(), I would note two things about liveHandler:

1. Calling closest, context argument still is not used.
I was unable to find the proper ticket. Would I open one?

2. Storing "how much a parent is close to an element" with data API is
an big overhead. An jQuery.lastCloser or something similar would be
enough. Also it would speed up sorting inside liveHandler with
somethin like this:

...
       elems.push({ elem: elem, fn: fn, closer: jQuery.lastCloser });
....
  elems.sort(function( a, b ) {
    return a.closer - b.closer;
  });

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.



Re: Will the live() method be improved in 1.4?

by furf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Fair enough, @john. I was unaware of the convention regarding
selectors. But isn't "write less, do more" also a convention? ;-)

$("#someRootTable").click(function(e){
  $(e.target).closest("td.foo", this).each(function(){
     // Your code goes here.
  });
});

vs.

$.live("#someRootTable td.foo", "click", function(){
  // Your code goes here.
});

Joking aside, your solution would probably solve our key cases at MLB,
although we would still need to use the live method for rendering and
editing dynamic data. But at least, the (unnecessary) selector is much
faster.

$("#someRootTable").live("click", function(e){
  $(e.target).closest("td.foo", this).each(function(){
     // Your code goes here.
  });
});

On the front end, we are rendering large tables of stats data
regularly and, on the back end, we have several interfaces for
manipulating large data, including an XML editor. In the case of the
XML editor, during common usage, $.live increased rendering
performance over $(...).live from 2s to 9ms by eliminating the need to
collect thousands of nodes and attributes.

We haven't noticed any significant performance issues using document
as the root context at event time. When we're acting on large
collections, the collections are usually the most important data on
the page and therefore not too far down in the DOM.

Thanks for the insights. I look forward to a few more at jsconf.

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.



Re: Re: Will the live() method be improved in 1.4?

by John Resig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> 1. Calling closest, context argument still is not used.
> I was unable to find the proper ticket. Would I open one?
>
> 2. Storing "how much a parent is close to an element" with data API is
> an big overhead. An jQuery.lastCloser or something similar would be
> enough. Also it would speed up sorting inside liveHandler with
> somethin like this:
>
> ...
>       elems.push({ elem: elem, fn: fn, closer: jQuery.lastCloser });
> ....
>  elems.sort(function( a, b ) {
>    return a.closer - b.closer;
>  });

I'd appreciate tickets/patches for both of these - they both sound
like great additions.

--John

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.



Re: Will the live() method be improved in 1.4?

by lrbabe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Adding the context to closest in liveHandler is really an easy thing
to fix...
What we need is a working implementation of the context.
Last time I talked to Brandon Aaron about that (back at the jQuery
conf) he told me that context was broken in his opinion and needed
some additional work before being useful...
Has anything changed?

On Nov 6, 3:01 pm, John Resig <jere...@...> wrote:

> > 1. Calling closest, context argument still is not used.
> > I was unable to find the proper ticket. Would I open one?
>
> > 2. Storing "how much a parent is close to an element" with data API is
> > an big overhead. An jQuery.lastCloser or something similar would be
> > enough. Also it would speed up sorting inside liveHandler with
> > somethin like this:
>
> > ...
> >       elems.push({ elem: elem, fn: fn, closer: jQuery.lastCloser });
> > ....
> >  elems.sort(function( a, b ) {
> >    return a.closer - b.closer;
> >  });
>
> I'd appreciate tickets/patches for both of these - they both sound
> like great additions.
>
> --John

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.



Re: Will the live() method be improved in 1.4?

by Robert Katić :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

event.currentTarget as context is not enough?

On Nov 6, 4:40 pm, lrbabe <lrb...@...> wrote:

> Adding the context to closest in liveHandler is really an easy thing
> to fix...
> What we need is a working implementation of the context.
> Last time I talked to Brandon Aaron about that (back at the jQuery
> conf) he told me that context was broken in his opinion and needed
> some additional work before being useful...
> Has anything changed?
>
> On Nov 6, 3:01 pm, John Resig <jere...@...> wrote:
>
> > > 1. Calling closest, context argument still is not used.
> > > I was unable to find the proper ticket. Would I open one?
>
> > > 2. Storing "how much a parent is close to an element" with data API is
> > > an big overhead. An jQuery.lastCloser or something similar would be
> > > enough. Also it would speed up sorting inside liveHandler with
> > > somethin like this:
>
> > > ...
> > >       elems.push({ elem: elem, fn: fn, closer: jQuery.lastCloser });
> > > ....
> > >  elems.sort(function( a, b ) {
> > >    return a.closer - b.closer;
> > >  });
>
> > I'd appreciate tickets/patches for both of these - they both sound
> > like great additions.
>
> > --John

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.



Re: Will the live() method be improved in 1.4?

by lrbabe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Exactly, it's as simple as that.
I actually thought that live wasn't taking advantage of the context
when using the syntax
$(selector, context).live(type, handler);
But I just tested it and it does work.
You can file the ticket.

On Nov 6, 5:29 pm, Robert Katić <robert.ka...@...> wrote:

> event.currentTarget as context is not enough?
>
> On Nov 6, 4:40 pm, lrbabe <lrb...@...> wrote:
>
> > Adding the context to closest in liveHandler is really an easy thing
> > to fix...
> > What we need is a working implementation of the context.
> > Last time I talked to Brandon Aaron about that (back at the jQuery
> > conf) he told me that context was broken in his opinion and needed
> > some additional work before being useful...
> > Has anything changed?
>
> > On Nov 6, 3:01 pm, John Resig <jere...@...> wrote:
>
> > > > 1. Calling closest, context argument still is not used.
> > > > I was unable to find the proper ticket. Would I open one?
>
> > > > 2. Storing "how much a parent is close to an element" with data API is
> > > > an big overhead. An jQuery.lastCloser or something similar would be
> > > > enough. Also it would speed up sorting inside liveHandler with
> > > > somethin like this:
>
> > > > ...
> > > >       elems.push({ elem: elem, fn: fn, closer: jQuery.lastCloser });
> > > > ....
> > > >  elems.sort(function( a, b ) {
> > > >    return a.closer - b.closer;
> > > >  });
>
> > > I'd appreciate tickets/patches for both of these - they both sound
> > > like great additions.
>
> > > --John

--

You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to jquery-dev@....
To unsubscribe from this group, send email to jquery-dev+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.


< Prev | 1 - 2 | Next >