You could drop the evaling altogether:

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;

$.getScript(scripts[n++], function(){
    if (scripts[n]) {
       $.getScript(scripts[n++], arguments.callee);
    } else {
       $('#foo1').dialog({...});
       $('#foo2').tabs({});
       $('#date1').datepicker({...});
       $('#foo3').resizable({...});
       $('#foo4').accordion({...});
    }
});

Have you tried
new Function(code)();
instead?

cheers,
- ricardo

On Mar 26, 8:15 am, Gilles <gil...@netxtra.net> wrote:
> Hi,
>
> I normally bebug my code myself, cos I believe it helps me improve
> myself, but here I just can't figure it out.
>
> basically I am writing a JQuery plugin, that JQuery plugin generate a
> bit of code that I then eval later. The code is a casacde of getScript
> with some initialization command being trigger in the middle (when all
> the getScript are finished)
>
> To make my life easy I thought I use $.globalEval(code) to make sure
> it works accross all browsers. Like expected no issue with safari 3,
> safari 4, FF2 or FF3 but as soon as i tried my test page on IE7
> everything broke...
>
> And of course I get the well know and very easy to debug error
> 80020101.
>
> 1. It's not because of comment (none used anywhere)
> 2. I have tried:
>
> eval(code)
> eval(code,$)
> window.eval(code)
> execScript(code)
> window.execScript(code)
> window['code'] = code; window.eval(window['code'])
> window['code'] = code; eval(window['code'])
> window['code'] = code; window.execScript(window['code'])
> window['code'] = code; execScript(window['code'])
> and many other approach I fund during my search (window.eval || eval)
> (code.... try {} catch {} etc....
>
> (debugging IE so tried any stupid way I could think off too which
> would explain some of the non-valid example above, I was desperate
> lol)
>
> 3. I have checked and checked the code I am trying to eval and I just
> don't get it, I am pretty sure it's not a JQuery bug of course, but as
> I am trying to do this via JQuery it give me an excuse to come and ask
> the JQuery community and team where the best javascript developers
> are! (kissing asses sometimes help :p)
>
> Here is the code I am trying to eval:
>
> Unformatted (I tried sending it using return carriage, compressed,
> with space none of them works)
>
> $.getScript('js/ui.core.js',function(){
>         $.getScript('js/ui.dialog.js',function(){
>                 $.getScript('js/ui.tabs.js',function(){
>                         $.getScript('js/ui.datepicker.js',function(){
>                                 $.getScript('js/ui.resizable.js',function(){
>                                         
> $.getScript('js/ui.accordion.js',function(){
>                                                 $('#foo1').dialog({ bgiframe: 
> true, height: 140, modal:
> true });
>                                                 $('#foo2').tabs({}); 
> $('#date1').datepicker({altField: '#alt',
> altFormat: 'DD, d MM, yy'});
>                                                 $('#foo3').resizable({ 
> maxHeight: 280, maxWidth: 440, minHeight:
> 155, minWidth: 200 });
>                                                 $('#foo4').accordion({ icons: 
> { 'header': 'ui-icon-plus',
> 'headerSelected': 'ui-icon-minus' } });
>                                         });
>                                 });
>                         });
>                 });
>         });
>
> });
>
> 4. One last thing that is weird, also nothing and nothing at all
> change sometimes it return an object doesn't support this property
> error instead....
>
> Here is the code building the code to eval:
>
> // Start creating the code to be eval at the end ( we cascade
> getScript)
> for (i = 0; i < jsl; i++) code += '$.getScript(\''+file[i]+'.js
> \',function(){';
>
> // Add our init functions (we are inside the callback function of the
> last getScript)
> if (init.length > 0) code += init.join('; ')+';';
>
> // Close all our getScripts
> for (i = 0; i < jsl; i++) code += '});';
>
> then just
>
> $.globalEval(code);
>
> to call it (used to test for ie, but got nothing that work with it, so
> no real point until I can debug the issue.
>
> If anyone can help please let me know I will really appreciate.
>
> Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to