Why not roll your own delegation function?
$(document).bind("click", {foo: "bar"}, function(e){
$(e.target).closest("a").each(function(){
// use e.foo
});
});
--John
On Wed, Jan 21, 2009 at 3:26 PM, seasoup <[email protected]> wrote:
>
> Yikes, that far off, eh. Is there another way to pass parameters in
> now?
>
> function move(e) {
> $(e.target).hide();
> alert(who.name + ' is moving in the shadows!!');
> }
> //...
> var ninja = {
> name: "Ninja Josh",
> hideInShadows : function() {
> who = this;
> $('a').live('click', move);
> }
> }
> The 'who' variable above works fine for singleton objects, but because
> of its global scope, using it with lowpro .klass, bar gets it
> overwritten by the last object of that klass to use it.
>
> var moveLike = "in the shadows!!";
> limits the scope so that move() doesn't have access...
>
> Ok, I figured out a way around it by resetting 'who' every time the
> object is used. Seems sloppy though. And it seems I went too deep
> into the ninja metaphor.
>
> function move(e) {
> $(e.target).hide();
> alert(who.name + ' is moving in the shadows!!');
> }
> //...
> var ninja = {
> name: "Ninja Josh",
> hideInShadows : function() {
> who = this;
> $('a').live('click', move);
> },
> appear : function() {
> who = this;
> }
> }
>
> On Jan 20, 5:57 pm, John Resig <[email protected]> wrote:
>> > Are we going to be able to pass parameters to the callback live
>> > function like we can with event callback functions?
>>
>> At some point - this is something that I was looking to tackle in 1.3.2.
>>
>> --John
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" 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/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---