[dojo-contributors] dojo.attr() - no disconnect

Peter E Higgins dante at dojotoolkit.org
Tue Oct 21 10:12:23 EDT 2008


I think that complicates the API some -- for the same convenience and
simplistic reasons NodeList.connect doesn't return a handle (though
thinking about it, maybe some form of meta-data-in-NodeList would be
useful here? unrelated, sorry -- ) it seems having attr handle what
.connect does directly is redundant and would confuse folks.

dojo.connect(node, "onmouseover', function(e){ ... }) // if you want the
handle
dojo.attr(node, {
       onclick: function(e){ ... }, id:"foo" // if you don't care
});

Regards,
Peter Higgins


Mike Wilcox wrote:
> Continuing my blog on dojo.attr()....
>
> I've realized that if you use dojo.attr to connect an event, you're  
> pretty much stuck with it and can't disconnect it.
>
> dojo.attr(node, "onmouseover")
>   - in FF returns null
>   - in IE returns the anonymous function from somewhere in dojo.connect.
>
> I think it would be preferable to return the handle to the connection.  
> Or more accurately, an array of handles, in the case of more than one  
> connection.
>
>
> Mike Wilcox
> mwilcox at sitepen.com
> http://www.sitepen.com
> work: 650.968.8787 x218
> cell:	  214.697.4872
>
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at dojotoolkit.org
> http://turtle.dojotoolkit.org/mailman/listinfo/dojo-contributors
>
>   




More information about the dojo-contributors mailing list