[mochikit] callLater and IE

2007-08-21 Thread Jonathan Marshall

Hi,

I'm not sure if this is a bug in Mochikit, or my error.

The following do not work in IE 6:

script
callLater(1, window.print);
callLater(2, alert, 'drink beer');
/script

yet these do:
script
function f() {
window.print();
}
function g() {
alert('drink beer');
}
callLater(1, f);
callLater(2, g);
/script

Works beautifully in Firefox though.Tried with Mochikit 1.3.1 and a
recent dump from SVN.

Any thoughts?
Jon.


--~--~-~--~~~---~--~~
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: callLater and IE

2007-08-21 Thread Bob Ippolito

On 8/21/07, Jonathan Marshall [EMAIL PROTECTED] wrote:

 Hi,

 I'm not sure if this is a bug in Mochikit, or my error.

 The following do not work in IE 6:

 script
 callLater(1, window.print);
 callLater(2, alert, 'drink beer');
 /script

 yet these do:
 script
 function f() {
 window.print();
 }
 function g() {
 alert('drink beer');
 }
 callLater(1, f);
 callLater(2, g);
 /script

 Works beautifully in Firefox though.Tried with Mochikit 1.3.1 and a
 recent dump from SVN.

Some of these built-in methods and functions aren't actual JavaScript
functions and aren't compatible with Function.prototype.apply, so
using MochiKit directly on them may not work. I think there's a
workaround for it in MochiKIt that makes it work in Firefox and maybe
Safari but I guess that workaround doesn't work properly in IE6.

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



[mochikit] Re: callLater and IE

2007-08-21 Thread Arnar Birgisson

On 8/21/07, Bob Ippolito [EMAIL PROTECTED] wrote:
 Some of these built-in methods and functions aren't actual JavaScript
 functions and aren't compatible with Function.prototype.apply, so
 using MochiKit directly on them may not work. I think there's a
 workaround for it in MochiKIt that makes it work in Firefox and maybe
 Safari but I guess that workaround doesn't work properly in IE6.

They are proper functions in Firefox and I believe also in Safari.
This is a known problem in IE which doesn't expose the proper Function
interface on it's built-ins.

There *is* a workaround in MochiKit, applied in Base.bind by wrapping
the function in Base._wrapDumbFunction. Maybe the condition that is
used to check if that workaround should be applied needs revision.
Currently it's
if (typeof(func) == function  typeof(func.apply) == undefined) {

I don't have time atm or the proper debugging tools to test this in
IE, but if there are no volunteers I'll have a look sometime.

Arnar

--~--~-~--~~~---~--~~
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: callLater and IE

2007-08-21 Thread Jonathan Marshall
On 8/21/07, Arnar Birgisson [EMAIL PROTECTED] wrote:


 There *is* a workaround in MochiKit, applied in Base.bind by wrapping
 the function in Base._wrapDumbFunction. Maybe the condition that is
 used to check if that workaround should be applied needs revision.
 Currently it's
 if (typeof(func) == function  typeof(func.apply) == undefined) {

 I don't have time atm or the proper debugging tools to test this in
 IE, but if there are no volunteers I'll have a look sometime.

 Arnar



Changing that to:
if (typeof(func) == object  typeof( func.apply) == undefined) {

works for me.

--~--~-~--~~~---~--~~
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: callLater and IE

2007-08-21 Thread Arnar Birgisson

On 8/21/07, Jonathan Marshall [EMAIL PROTECTED] wrote:
 Changing that to:
 if (typeof(func) == object  typeof( func.apply) == undefined) {
 works for me.

Good. Would you be able to add some tests using your examples and
submit them as well as the fix as a patch? Then we can test it on the
various platforms and commit it if everything works.

Arnar

--~--~-~--~~~---~--~~
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: Form Validation

2007-08-21 Thread [EMAIL PROTECTED]

I ran into this a few months ago myself.  I ended up writing a form
validation script that uses json data returned from the server to
either display validation errors or a submission confirmation.  This
has worked out pretty well, and been fairly easy to replicate on other
forms.

On Aug 20, 7:53 am, Jason Bunting [EMAIL PROTECTED]
wrote:
  Lee Connell asked:
   Are there form validation helpers in mochikit?

 No and yes - there are not any in the sense you are probably thinking, but
 by virtue of the fact that MochiKit makes JavaScript suck less, there are.
 Hope that makes sense.

 Look through the relatively complete documentation and you will see what is
 provided; MochiKit has very little in its API that is as task-specific as
 form validation helpers, instead providing generic helps.

 Jason Bunting

 No virus found in this outgoing message.
 Checked by AVG Free Edition.
 Version: 7.5.484 / Virus Database: 269.12.0/961 - Release Date: 8/19/2007
 7:27 AM


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