#96 ✓resolved
angelo (at dinardi)

Script tags aren't being executed as expected

Reported by angelo (at dinardi) | February 22nd, 2010 @ 08:12 PM | in 1.2.x

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.

Comments and changes to this ticket

  • nickg

    nickg March 1st, 2010 @ 07:27 PM

    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{
    +    }
                 //handle inline scripts
    @@ -73,7 +73,7 @@ Envjs.loadLocalScript = function(script){
                 Envjs.onScriptLoadError(script, e);
                 return false;
    -    }
    @@ -125,4 +125,4 @@ Envjs.loadLocalScript = function(script){
         return true;
    \ No newline at end of file
  • Thatcher

    Thatcher March 2nd, 2010 @ 07:42 AM

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

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

a javascript browser environment

People watching this ticket