Hi, I recently posted a message about event binding syntax, but the point I want to discuss is more foundamental. I've been surprised to see the namespace syntax around events :
At this time, jquery manages only one level of namespace ( no subnamespace ) and the namespaces are put after event names : $(obj).bind( 'event.namespace1.namespace2' ); $(obj).trigger( 'event' ) // triggers all .. In all languages I know, namespaces are put to the left, and the syntax a.b.c signifies c child namespace of b child namespace of a. Here is the behavior I would find intuitive ( a is parent namespace, a.b is child namespace, a.b.c is leaf ) $(obj).bind( 'a', function() { alert( 'ok' ); } ); $(obj).triggerHandler( 'a.b.c' ); // executes alert( 'ok' ); ( a kind of propagation to parent namespaces ) $(obj).bind( 'a.b.c', function() { alert( 'ok1' ); } ); $(obj).bind( 'a.b.e', function() { alert( 'ok2' ); } ); $(obj).triggerHandler( 'a.b' ); // executes alert( 'ok1' ); alert ( 'ok2' ) If I understand, the right-to-left syntax has been choosen because you wanted to have always the event name in the triggering call, but if you name it like that : $(obj).bind( 'globalClick.subClick.leafClick', function() { alert ( 'ok2' ); } ); we can consider that there is a relation of generalisation/ specialisation between two namespaces and it keeps the semantic. The reason why I want to use this syntax is that I create a lot of components and create a lot of specific events. To keep it clear, I must use a hierarchical organisation. What do you think about that ? Ludovic --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---