[mochikit] Weird bug in MochiKit.Style.getElementPosition

2008-12-12 Thread Per Cederberg
Hi, I ran across a weird bug in MochiKit.Style.getElementPosition causing FF to throw evil C++ exceptions into the console: http://trac.mochikit.com/ticket/332 Debugging the MochiKit code I ended up looking at the following piece of black magic: getElementPosition: function (elem, /*

[mochikit] connectEach shortcut

2008-12-12 Thread Eoghan
I often use the following utility function: function connectEach(iterable, signal, dest, func){ forEach(iterable, function(el){ connect(el, signal, dest, func); }); } It might be used as follows: connectEach($$('#my-ul li'), 'onclick',

[mochikit] Re: connectEach shortcut

2008-12-12 Thread Arnar Birgisson
Hi On 12.12.2008, at 16:45, Eoghan eoghanomur...@gmail.com wrote: connectEach($$('#my-ul li'), 'onclick', function(e){ // do sumn' }); rather than slightly more unwieldy: forEach($$('#my-ul li'), function(el){ connect(el, 'onclick', function(e){

[mochikit] Re: connectEach shortcut

2008-12-12 Thread Eoghan
On Dec 12, 7:20 pm, Arnar Birgisson arna...@gmail.com wrote: Hi On 12.12.2008, at 16:45, Eoghan eoghanomur...@gmail.com wrote:    connectEach($$('#my-ul li'), 'onclick', function(e){                // do sumn'         }); rather than slightly more unwieldy:    forEach($$('#my-ul

[mochikit] Re: connectEach shortcut

2008-12-12 Thread Bob Ippolito
On Fri, Dec 12, 2008 at 11:20 AM, Arnar Birgisson arna...@gmail.com wrote: Hi On 12.12.2008, at 16:45, Eoghan eoghanomur...@gmail.com wrote: connectEach($$('#my-ul li'), 'onclick', function(e){ // do sumn' }); rather than slightly more unwieldy:

[mochikit] Re: connectEach shortcut

2008-12-12 Thread Arnar Birgisson
Hi, On Sat, Dec 13, 2008 at 00:45, Bob Ippolito b...@redivi.com wrote: connect([#my-ul li], onclick, ...); I agree this looks a little bit too magical. Perhaps more expected would be to allow the first argument to be a list, but in that case a list of elements (or strings passed to