Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#526 closed enhancement (fixed)

Requesting dojo.event.connect always set up "this"

Reported by: cris@… Owned by: anonymous
Priority: high Milestone:
Component: Core Version: 0.2
Keywords: event, connect, currentTarget Cc: jeoffwilks@…
Blocked By: Blocking:

Description

If I set up <div onclick="doSomething(this)">and text</div>, the browser will set up the DIV element as "this" when the handler runs. It would be really nice if Dojo could set up effectively the same thing when I do:

dojo.event.connect(myDiv, "onclick", function(evt) {doSomething(this)})

(The enhancement would also be useful when using "connect" for putting advice on methods.)

thanks

Change History (4)

comment:1 Changed 14 years ago by sjmiles

Resolution: fixed
Status: newclosed

We don't call connect functions in the context of the srcObj, but I've modified the event code so that evt.currentTarget is valid (for DOM events). See: http://trac.dojotoolkit.org/ticket/527 for more information.

Re: advice objects, note that in general you can do something like this: dojo.event.connect(myObj, "method", function(evt){ doSomething(myObj) })

comment:2 Changed 14 years ago by sjmiles

Milestone: 0.3release

comment:3 Changed 14 years ago by sjmiles

Keywords: event connect currentTarget added

comment:4 Changed 12 years ago by (none)

Milestone: 0.3release

Milestone 0.3release deleted

Note: See TracTickets for help on using tickets.