Wed Feb 7 16:15:45 MST 2007
dojo.event.connect() calls a lower-level function (can't remember the name
right now -- dojo.browser.addEventListener?) .
Anyway, that lower-level function then wraps your given event handler
function in a function which "fixes" events. It then uses that new "wrapped"
function to actually call the browser's addListener flavor. Finally, it
returns that wrapped function. If you call disconnect with your original
function, nothing will happen.
I suppose the idea is that the caller is supposed to save that wrapped
function, and use THAT function, not your original event handler, to call
problem is same old song you usually hear with dojo -- It doesn't SAY
that anywhere. The docs imply, perhaps outright state, that you're
supposed to use your original function. Now
I can't remember exactly what the docs
say, because I stopped reading the dojo docs a while ago for this very
reason. Bottom line you have to read the source code with dojo.
I just can't resist a couple of rants, here, because I've personally wasted
dozens of hours of time chasing down nit details like this that could have
been avoided with a few hours of time spent on docs.
Note that these are my personal opinion, nothing more, and they're WAY
off-topic for the first part of this message (so stop reading now if you
want), but as I was writing the reply, I realized that I've been struggling
with the same issues over and over with dojo.
One -- dojo is not so great at cleaning up after itself. Mostly this isn't
the fault of dojo itself, but misunderstandings of how things work in dojo's
innards -- this case here is a pretty good example of how dojo sometimes
makes it hard to do the Right Thing. This is only an impression, but it
seems to me that there is a lot of colloquial knowledge about how to make a
widget, how to set an event handler, how to start an animation, etc, etc.
BUT precious little of how to destroy a widget, how to disconnect an event
handler, and how to stop an animation. It's like it's great for the quick
demo, but the dirty little secret is that you need to dig, and dig hard to
find how to undo some stuff, clean up and avoid leaks.
There are just too many place that seem to require arcane knowledge of
dojo's internals to do what ought to be simple things.
-- there is WAY too much magic going on in some of the source to have
it serve as the primary source of docs. The argument mangling in
dojo.event.connect is a pretty good example of this.
To expect a dojo newbie (I'm not talking about a JS newbie, just a dojo
newbie) to wade through dojo.event.connect, or dojo.lang.curry, or any one
of a dozen others to find out what's going on is to not just invite, but
practically to guarantee a case of frustration. Most of us just want to USE
dojo, not live in it. Another example: there are like a dozen functions in
dojo.html for getting the size of a DOM node with various flavors of
borders, or padding, or box model, or whatever. There is nowhere that
explains the INTENT of those functions -- when you check with borders, and
Now it's great that dojo is being re factored and all, but does anyone else
find it ironic that the main mechanism for a user from getting from 4.x to
9.x is going to be.........a doc? The very thing that dojo hasn't been able
to properly pull off yet is going to be the path from one undocumented
version to another undocumented version?
Bottom line: Dojo needs docs. Badly. Really badly. There will be an
"we know that". I know you know it. This has been bandied
back-and-forth for well nigh a year, and there are still no credible
Why are questions like the OP's still coming up month after month?
Content-Type: text/html; charset=ISO-8859-1
More information about the Dojo-interest