[mochikit] DragAndDrop and MichiKit.DOM._document/_window

2008-01-23 Thread Hugo

Hello,

I'm meeting an issue with the DragAndDrop class :
I'm using an iFrame. The parent container loads all my libraries
(MochiKit and my own) in order to avoid long loading time with every
page change. For that, I change the value of the
MichiKit.DOM._document and MichiKit.DOM._window (because using
withWindow function would be wordy). But unfortunately, DragAndDrop
never uses these attributes and seems to prefer document and window
(thus : those of the parent container of my iFrame).
Given that DragAndDrop depends on DOM, why wouldn't you use
MichiKit.DOM._window/_document instead of window/document ?

Thank you very much for your help.

Hugo Smadja.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---



[mochikit] deferred callbacks that throw errors

2008-01-23 Thread SimonS

Hi,

I'm curious about the effect of the following code:

  var d  = new Deferred();
  d.addCallback(function() { alert('f');  throw new
GenericError('foo'); });
  d.addErrback(function() { alert('e'); });
  d.addCallback(function() { alert('s'); });
  d.callback('success');

The result I observe is that all three alerts fire, in the order 'f',
'e', 's'.  This happens even though the first callback (f) throws an
exception.  My question is why is the last alert fired?

The docs say that a callback that throws an exception will put the
deferred into an error state.  Since the deferred transitions to an
error state, why does it continue calling the 'success' chain?

Is there a simple way to abort the callback chain from one of the
callbacks?

Many thanks!

Simon.

PS:  I'm using MochiKit from svn at about 4 months ago, so apologies
if this is not reproducible in the current version!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---



[mochikit] Re: deferred callbacks that throw errors

2008-01-23 Thread Bob Ippolito

On Jan 23, 2008 9:07 PM, SimonS [EMAIL PROTECTED] wrote:

 Hi,

 I'm curious about the effect of the following code:

   var d  = new Deferred();
   d.addCallback(function() { alert('f');  throw new
 GenericError('foo'); });
   d.addErrback(function() { alert('e'); });
   d.addCallback(function() { alert('s'); });
   d.callback('success');

 The result I observe is that all three alerts fire, in the order 'f',
 'e', 's'.  This happens even though the first callback (f) throws an
 exception.  My question is why is the last alert fired?

 The docs say that a callback that throws an exception will put the
 deferred into an error state.  Since the deferred transitions to an
 error state, why does it continue calling the 'success' chain?

 Is there a simple way to abort the callback chain from one of the
 callbacks?

It continues calling the success chain because the errback doesn't
return an error or raise an exception.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---