Ticket #526 (closed enhancement: fixed)

Opened 3 years ago

Last modified 20 months ago

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

Reported by: cris@… Owned by: anonymous
Priority: normal Milestone:
Component: Core Version: 0.2
Severity: normal Keywords: event, connect, currentTarget
Cc: jeoffwilks@…

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

Changed 3 years ago by sjmiles

  • status changed from new to closed
  • resolution set to fixed

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) })

Changed 3 years ago by sjmiles

  • milestone set to 0.3release

Changed 3 years ago by sjmiles

  • keywords event, connect, currentTarget added

Changed 20 months ago by anonymous

  • milestone deleted

Milestone 0.3release deleted

Note: See TracTickets for help on using tickets.