Re: [jQuery] Working on a getScripts plugin

2006-11-26 Thread Andrea Ercolino
Christof Donat wrote: In another thread (getScript error), we were discussing alternatives because it seems not to work as expected, at least for a delay of 0 milliseconds. Are you talking about this thread?

Re: [jQuery] Working on a getScripts plugin

2006-11-26 Thread Christof Donat
Hi, The thread I was referring to is this one: http://www.nabble.com/getScript-error-tf2652417.html OK, It leads to the same solution. I simply added this to my code: if( ! window.execScript ) window.execScript= function(src) { eval.call(window,src); }; One of my last messages

Re: [jQuery] Working on a getScripts plugin

2006-11-25 Thread Christof Donat
Hi, In another thread (getScript error), we were discussing alternatives because it seems not to work as expected, at least for a delay of 0 milliseconds. Are you talking about this thread? http://www.nabble.com/eval.call(-window,jscode)-does-not-work-in-IE-tf2202851.html#a6099563 The

Re: [jQuery] Working on a getScripts plugin

2006-11-25 Thread Christof Donat
Hi, I've looked at your package.js, and I've found that you use the setTimeout method for evaluating the loaded script in the global scope, with a delay of 1 millisecond. Don't you have any problems with that? No, I have not experienced any problems with that up to now. I guess, that it

[jQuery] Working on a getScripts plugin

2006-11-24 Thread Andrea Ercolino
Some days ago I wrote this getScripts plugin, as a macro for shrinking this $.getScript( f1.js, function() { $.getScript( f2.js, function() { $.getScript( f3.js, function() { do_it(); } ); } ); } ); to this $.getScripts( [

Re: [jQuery] Working on a getScripts plugin

2006-11-24 Thread Andrea Ercolino
To restore tabs, see this message from http://www.nabble.com/Working-on-a-getScripts-plugin-tf2696465.html -- View this message in context: http://www.nabble.com/Working-on-a-getScripts-plugin-tf2696465.html#a7519622 Sent from the JQuery mailing list archive at Nabble.com.

Re: [jQuery] Working on a getScripts plugin

2006-11-24 Thread Andrea Ercolino
Christof Donat wrote: You can have that a lot cheaper. How about this: jQuery.getScripts = function(scripts,callback) { if( scripts.length == 0 ) { callback(); return; } jQuery.getScript(scripts[0],function() {

Re: [jQuery] Working on a getScripts plugin

2006-11-24 Thread Christof Donat
Hi, But I don't understand the drawback. If the loaded scripts are evaluated as soon as they are loaded, before calling the callback in $.getScript AFAIK, there should be no problem, except that getScript does not support library registration, so there is a risk for looping indefinitely.

Re: [jQuery] Working on a getScripts plugin

2006-11-24 Thread Andrea Ercolino
Christof Donat wrote: $.getScript() is assynchonous. That means, that it returns before the script is loaded. Yes, but if I put all my code into the callback? -- View this message in context: http://www.nabble.com/Working-on-a-getScripts-plugin-tf2696465.html#a7524534 Sent from the

Re: [jQuery] Working on a getScripts plugin

2006-11-24 Thread Christof Donat
Hi, $.getScript() is assynchonous. That means, that it returns before the script is loaded. Yes, but if I put all my code into the callback? That does not help, if your loaded script needs to load another script. Christof ___ jQuery mailing

Re: [jQuery] Working on a getScripts plugin

2006-11-24 Thread Andrea Ercolino
Christof Donat wrote: That does not help, if your loaded script needs to load another script. For example: file a.js is [ $.getScript( b.js, function() { doA(); } ); ] file b.js is [ $.getScript( c.js, function() { doB(); } ); ] file c.js is [ doC(); ] the page has: [ script src=jquery.js

Re: [jQuery] Working on a getScripts plugin

2006-11-24 Thread Christof Donat
Hi, That does not help, if your loaded script needs to load another script. For example: file a.js is [ $.getScript( b.js, function() { doA(); } ); ] file b.js is [ $.getScript( c.js, function() { doB(); } ); ] file c.js is [ doC(); ] the page has: [ script src=jquery.js - script

Re: [jQuery] Working on a getScripts plugin

2006-11-24 Thread Andrea Ercolino
Christof Donat wrote: No, the order could be doA() doC() doB(). That is because doA() is called as soon as b.js is loaded but before c.js is loaded. The call to $.getScript() in b.js returns immediatelly and loads c.js assynchonously. Then b.js is finished and doA() is called while

Re: [jQuery] Working on a getScripts plugin

2006-11-24 Thread Christof Donat
Hi, No, the order could be doA() doC() doB(). That is because doA() is called as soon as b.js is loaded but before c.js is loaded. The call to $.getScript() in b.js returns immediatelly and loads c.js assynchonously. Then b.js is finished and doA() is called while c.js is still

Re: [jQuery] Working on a getScripts plugin

2006-11-24 Thread Andrea Ercolino
Christof Donat wrote: No. In your example b.js is completelly evaluated before the doA() is called, but that only means, that the download of c.js has been started. As soon as that has finished, doB() is called, but that can be after doA() has been called. $.getScript() initiates

Re: [jQuery] Working on a getScripts plugin

2006-11-24 Thread Christof Donat
Hi, An alternative could be to inspect any loaded script and see if it requires more scripts (recursively). I think that that would be too complicated. In jsPax I simpy expect the scripts to generate a specific Object which depends on the name of the script. If that object exists after the

Re: [jQuery] Working on a getScripts plugin

2006-11-24 Thread Andrea Ercolino
Christof Donat wrote: I don't use jQuery in jsPax, because I load jQuery as a jsPax-package It's just what I'm interested in. An independent script to add to a page and have it load what is needed: nice shot Christof! I've looked at your package.js, and I've found that you use the