On Sun, Mar 29, 2009 at 7:12 AM, Gilles <gil...@netxtra.net> wrote: > Also could you explain what $.getScript(scripts[n++], > arguments.callee); actually does? I am not sure of what > arguments.callee refers to.
It is the function itself. It was put in to the language to make recursion of an anonymous function possible. function fib(n) { if(n==0) return 0; if(n==1) return 1; return fib(n-2) + fib(n-1); } is the same as function fib2(n) { if(n==0) return 0; if(n==1) return 1; return arguments.callee(n-2) + arguments.callee(n-1); } The example code could be revised to not need arguments.callee: var scripts = [ 'js/ui.core.js', 'js/ui.dialog.js', 'js/ui.tabs.js', 'js/ui.datepicker.js', 'js/ui.resizable.js', 'js/ui.accordion.js'], n = 0; function load_handler(){ if (scripts[n]) { $.getScript(scripts[n++], load_handler); } else { $('#foo1').dialog({...}); $('#foo2').tabs({}); $('#date1').datepicker({...}); $('#foo3').resizable({...}); $('#foo4').accordion({...}); } } $.getScript(scripts[n++], load_handler); Regards, John Campbell --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---