Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Script tags aren't being executed as expected

#96

I have an HTML page with some <script type="text/javascript"> (or text/envjs) tags their contents aren't being executed. Upon review of the env-js source it looks like the Envjs.loadLocalScript function has a bit of an issue.

If a script tag has a type attribute it can only load via src attribute. If the script tag has no attributes (eg <script>) it works as intended. There's an if statement switching on script.type and the inline script loading is in the else block. At least that's how it looks.

I can provide more information if necessary.

Reported by angelo (at dinardi) · February 22nd, 2010 @ 08:12 PM

State: resolved
Milestone: 1.2.x
Assigned to: Thatcher Thatcher

Activity

  1. nickg
    nickg

    More specifically, I think the fix is the following.

    diff --git a/src/platform/core/html.js b/src/platform/core/html.js
    index 467e643..781d04f 100644
    --- a/src/platform/core/html.js
    +++ b/src/platform/core/html.js
    @@ -62,7 +62,7 @@ Envjs.loadLocalScript = function(script){
                 if(i+1 == types.length)
                     return false;
             }
    -    }else{
    +    }
             try{
                 //handle inline scripts
                 if(!script.src)
    @@ -73,7 +73,7 @@ Envjs.loadLocalScript = function(script){
                 Envjs.onScriptLoadError(script, e);
                 return false;
             }
    -    }
    +    
             
             
         if(script.src){
    @@ -125,4 +125,4 @@ Envjs.loadLocalScript = function(script){
         }
         return true;
     };
    -    
    \ No newline at end of file
    +
    

    March 1st, 2010 @ 07:27 PM

  2. Thatcher
    Thatcher
    • Assigned user set to Thatcher
    • State changed from new to resolved
    • Tag set to linline, script, type
    • Milestone set to 1.2.x

    March 2nd, 2010 @ 07:42 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.