[mochikit] connect to keyboard events not working in FireFox?

2010-02-05 Thread SimonS
Hi,

The following works for me in IE, Chrome and Safari, but fails in
FireFox 3.6 (running on Vistax64).  The 'key down' event just doesn't
seem to get received:

=

html
  head
script type='text/javascript' src='MochiKit.js'/script
script type='text/javascript'
  addLoadEvent(function() {
  connect(document.body, 'onkeydown', function(evt) {
$('key').innerHTML = evt.key().string;
  });
  });
/script
  /head
  body
h1PRESS A KEY/h1
div id='key'/div
  /body
/html

===

It seems fairly simple - any idea what's wrong here?

Cheers,

Simon.

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



[mochikit] Re: connect to keyboard events not working in FireFox?

2010-02-05 Thread SimonS
I investigated further and I think you're right.   However I found an
easier solution:  binding the event to the window instead of the body
works without any tab index.  However it does *not* work in IE.  Sigh
- browser specific hacks either way.

In any case it's not MochiKit's fault:  I verified that subscribing to
the same event using the DOM event api directly has the same result.

Thanks!

Simon.

On Feb 6, 12:02 am, Per Cederberg cederb...@gmail.com wrote:
 A bit of Googling found a suggestion for test:

 
 Firefox seems to need to have the tabindex=0 property set to some
 value so it knows this Div or Span is keyboard selectable. That allows
 the keyboard event to be triggered.
 

 Perhaps that does the trick?

 Cheers,

 /Per - without the testing time right now



 On Fri, Feb 5, 2010 at 08:34, SimonS ssade...@gmail.com wrote:
  Hi,

  The following works for me in IE, Chrome and Safari, but fails in
  FireFox 3.6 (running on Vistax64).  The 'key down' event just doesn't
  seem to get received:

  =

  html
   head
     script type='text/javascript' src='MochiKit.js'/script
     script type='text/javascript'
       addLoadEvent(function() {
           connect(document.body, 'onkeydown', function(evt) {
             $('key').innerHTML = evt.key().string;
           });
       });
     /script
   /head
   body
     h1PRESS A KEY/h1
     div id='key'/div
   /body
  /html

  ===

  It seems fairly simple - any idea what's wrong here?

  Cheers,

  Simon.

  --
  You received this message because you are subscribed to the Google Groups 
  MochiKit group.
  To post to this group, send email to mochi...@googlegroups.com.
  To unsubscribe from this group, send email to 
  mochikit+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/mochikit?hl=en.

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



[mochikit] Re: deferred callbacks that throw errors

2008-01-24 Thread SimonS

  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.

Thanks - I tried throwing an exception from the errback as you suggest
and it does what I want (stops further success callbacks happening).

Cheers,

Simon.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---