[jQuery] Binding one function to multiple events causes overwriting?

[jQuery] Binding one function to multiple events causes overwriting?


If I set up some functions like this:
myFunctions = {
foo: function() {
alert("Foo");
},
doFoo: function() {
myFunctions.foo();
}
}
And then in .ready() make the following calls:
$(window).bind("eventFoo", myFunctions.foo);
$(window).bind("eventBar", myFunctions.foo);
From the documentation, it seems that calling either $(window).trigger
("eventFoo") or $(window).trigger("eventBar") should both cause the
alert box to display.
In practice I'm finding that "eventBar" is the only thing that works,
and "eventFoo" does nothing at all. The same thing happens if I stack
the events as $(window).bind("eventFoo eventBar", myFunctions.foo);
In addition, if I change my code as follows, everything works as
expected.
$(window).bind("eventFoo", myFunctions.foo);
$(window).bind("eventBar", myFunctions.doFoo);
It would appear that for some reason the second call is overwriting
the first, but that doesn't make much sense. Have I stumbled on a bug,
or am I doing something wrong?