I think it's working as designed. If you're trying to trigger
"my.event" then regardless of whether it's a "my.event" in the "a" or
the "b" namespace it should be triggered.

If you think about it with "normal" events:

$('#button').bind('click', function(){ /* ... */ });
$('#button').bind('click.mySpace1', function(){ /* ... */ });
$('#button').bind('click.anotherNameSpace', function(){ /* ... */ });

// This should trigger all 3 functions
$('#button').trigger('click');

Karl Rudd

On Thu, Jan 15, 2009 at 9:15 PM, Stephan <stephan.ve...@gmail.com> wrote:
>
> Hi,
>
> I have problems with namespacing my events. When I use something like
> my.event everything works fine, but if I have my.event.a and
> my.event.b, both events are bound to my.event.
>
> Is this a bug or a special feature?
>
>
> my test code:
>
> JavaScript:
>        var trigger = 0;
>        var clicked = 0;
>
>        $().bind("my.event.a", function() {
>                $("#trigger").text(++trigger);
>        });
>
>        $("#button").click(function(){
>                $().trigger("my.event.a");
>                $().trigger("my.event.b");
>                $().trigger("my.event.c");
>                $("#click").text(++clicked);
>        });
>
> HTML:
>        <p>Trigger Count: <span id="trigger">0</span></p>
>        <p>Button Clicked: <span id="click">0</span></p>
>        <button id="button">trigger</button>
>
> When you press the button, clicked is increased by 1, but trigger is
> increased by 3.
>
>
> by(e)
> Stephan
>
>

Reply via email to