Hi Dave,
Thanks for responding. I'll try to respond to your points below:

>
> Is there a way to designate an element that naturally holds the data,
> then use .data() to access it? For example, if all the clients were
> form elements, you could associate the data with the form. You could
> pass a common object as the data parameter to .bind(), but it seems
> like that might create a closure too.


I think the issue is that applications, even web ones, aren't always  
organized strictly according to the DOM. Some applications may span  
pages, and multiple DOM elements. Sure, there is always at least one  
dom node it's associated with (the body), but if you're going to have  
it in a global space, you might as well drop data segregation and  
namespacing altogether.

> Seems like that could be implemented by just extending the event
> object in jQuery.event.fix with some base object. The main concern I'd
> have is that it's done at every event delivery, but if it was a small
> object it would be relatively cheap.


Is that something that can be done via a plugin, or is it either  
overwriting the fix method, or overloading it, or is it something that  
should be strictly handled by the core?

> The order that the event is delivered to all the listeners isn't well
> defined, is it? You wouldn't know which listeners had already gotten
> the event, so data sharing wouldn't seem very useful for listeners to
> communicate with each other.


I always thought that the event order was FIFO. I could be wrong, but  
I can see why managing an event queue might be troublesome or  
confusing in a global context, in a localized one (especially with  
custom events), it makes more sense.
But overall, the same confusion arises if one part of your script does:

jQuery('a.my-custom').bind('click.custom');

and another part does:

jQuery('a').unbind();

And data sharing in the events would be more or less something for  
handling localized events. I know YUI's event management handles this,  
which is why I was curious if there was a way to do it in the jQuery  
event system.

Anyways, thanks for the response Dave. I hope that adds some clarity  
to my questions.


Nate Cavanaugh
Director of User Interface Engineering
Liferay, Inc.
Enterprise. Open Source. For life.





On Nov 11, 2008, at 5:38 PM, Dave Methvin wrote:

>
>> We often have groups of methods that need to access common data that
>> doesn't logically associate to just one DOM element.
>
> Is there a way to designate an element that naturally holds the data,
> then use .data() to access it? For example, if all the clients were
> form elements, you could associate the data with the form. You could
> pass a common object as the data parameter to .bind(), but it seems
> like that might create a closure too.
>
>> Modifying the event object that's passed into the listener
>
> Seems like that could be implemented by just extending the event
> object in jQuery.event.fix with some base object. The main concern I'd
> have is that it's done at every event delivery, but if it was a small
> object it would be relatively cheap.
>
>        event = jQuery.extend({ originalEvent: originalEvent },
> jQuery.baseEventObject);
>
>> I would like the behavior to completely halt the loop, and for
>> events to be able to pass data between the listeners (which I think  
>> is
>> already possible if you pass around an object).
>
> The order that the event is delivered to all the listeners isn't well
> defined, is it? You wouldn't know which listeners had already gotten
> the event, so data sharing wouldn't seem very useful for listeners to
> communicate with each other.
>
> >




Nate Cavanaugh
Director of User Interface Engineering
Liferay, Inc.
Enterprise. Open Source. For life.






--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to