[BUG]: simple scripts defined inside <script> tag aren't correctly interpreted on firefox

Last post 04-04-2006 6:16 PM by Eilon. 3 replies.

Sort Posts:

  • [BUG]: simple scripts defined inside <script> tag aren't correctly interpreted on firefox

    04-04-2006, 5:29 AM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 6:22 AM
    • Madeira [Portugal]
    • Posts 5,368
    • TrustedFriends-MVPs

    Hello.

    I've found this bug while using firefox. on the _updateScripts methods of the atlas platform, you can find this:

    if

    (xmlScriptNode.childNodes.length != 0) {

    for (var c = xmlScriptNode.childNodes.length - 1; c >= 0; c--) {

    var nodeType = xmlScriptNode.childNodes[c].nodeType;

    if ((nodeType == 3) || (nodeType == 4) || (nodeType == 8)) {

    text = xmlScriptNode.childNodes[c].nodeValue;

    break;

    }

    }

    }

    The problem is in the bold line (it's around line 11289 of the atlas.js file). if you receive a script line this from an atlas postback:

    <script type="text/javascript">
    <!--
    var Page_Validators = new Array(document.getElementById("ButtonLabelContainer_ctl00_ButtonTextValidator"), document.getElementById("ButtonLabelContainer_ctl01_ButtonTextValidator"));
    // -->
    </script>

    it won't be interpreted correctly by firefox since it consideres "\n" to be a correct node. to solve this, i've modified the previous excerpt to look like this:

     

    if

    (xmlScriptNode.childNodes.length != 0) {

    for (var c = xmlScriptNode.childNodes.length - 1; c >= 0; c--) {

    var nodeType = xmlScriptNode.childNodes[c].nodeType;

    if ((nodeType == 3) || (nodeType == 4) || (nodeType == 8)) {

    text = xmlScriptNode.childNodes[c].nodeValue;

    if( text == "\n")

    {

    continue;

    }

    break;

    }

    }

    }

    this garantees that when firefox gets one of those "\n" it jumps to the next instruction (which in the previous case, will be the Page_Validators array.

    btw, you can see a real example where this kind of behvaior happens in this post:

    http://forums.asp.net/1247033/ShowThread.aspx#1247033

    thanks.

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: [BUG]: simple scripts defined inside <script> tag aren't correctly interpreted on firefox

    04-04-2006, 2:04 PM
    • Contributor
      7,416 point Contributor
    • Garbin
    • Member since 09-17-2004, 12:35 PM
    • Sassari, Italy
    • Posts 1,506
    • ASPInsiders
      TrustedFriends-MVPs

    Hi,

    I remember that in the previous CTP I had fixed this issue in my files, in this way:

    [...]

    var text = '';

    if (xmlScriptNode.hasChildNodes) {
       
        for(var c = 0; c < xmlScriptNode.childNodes.length; c++) {
           
            var nodeType = xmlScriptNode.childNodes[c].nodeType;
           
            if(nodeType == 3) {
                text += xmlScriptNode.childNodes[c].nodeValue;
                continue;
            }
            if (nodeType == 8 || nodeType == 4) {
                text = xmlScriptNode.childNodes[c].nodeValue;
                break;
            }
        }
    }
    else {
        text = xmlScriptNode.nodeValue;
    }

    [...]

    but I have tested it only a few times, so I'm not sure this is the best fix.
    Alessandro Gallo | Blog | My book: ASP.NET AJAX In Action
  • Re: [BUG]: simple scripts defined inside <script> tag aren't correctly interpreted on firefox

    04-04-2006, 2:07 PM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 6:22 AM
    • Madeira [Portugal]
    • Posts 5,368
    • TrustedFriends-MVPs

    hello.

    yes, i think that your approach solves the problem too...

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: [BUG]: simple scripts defined inside <script> tag aren't correctly interpreted on firefox

    04-04-2006, 6:16 PM
    • Contributor
      5,514 point Contributor
    • Eilon
    • Member since 06-26-2002, 6:14 PM
    • Redmond, WA
    • Posts 945

    Hi Luis, this is a known issue and we have this fixed for our next CTP.

    Thanks for the bug report!

    - Eilon

    Blog: http://weblogs.asp.net/LeftSlipper/
Page 1 of 1 (4 items)