I think it's ok the way it is now. e.data is for bind-time data and the arguments are for trigger-time data.
You can though pass a data object every time you trigger, that is, passing it as the event object (must have type) then the data will be copied to the event object you'll get. -- Ariel Flesler On Jun 7, 12:14 pm, sks <simon.shep...@googlemail.com> wrote: > Hi, > I'm a big fan of JQuery, it's totally changed the way I write > Javascript. > > One thing it's started to make me do is to use custom events a lot > more but something that has struck me is that the event.trigger seems > to be somewhat inconsistent with the rest of the api in terms of > passing variables around. > The specific piece that I'm taking about is the event.data, when you > bind things, you can incorporate the data into the call e.g. > > foo.bind("bar", {foo: bar}); - where foo becomes a property of > event.data > > but when I trigger things I have to do this: > > foo.trigger("bar", [{foo: bar1}]) > > and the extra data comes in as a second argument to the event being > called. > > While this is quite useful functionality, I feel it does depart > somewhat from the original, I would expect to pass in an object that > could extend and overwrite the original event.data object as well as > being able to pass in extra arguments, so it might look something more > like this: > > foo.trigger("bar", {foo: bar1}, [{foo2: bar}]; > > where the 2nd argument ({foo: bar1}) overwrites the original property > ({foo: bar}) like > jQuery.extend({}, event.data, latestData); > > I was wondering if there is any specific reason it is done this way & > whether there is anywhere I could suggest that it is altered? > > Thanks > > Simon --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---