1. #1
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,505
    Vote Rating
    53
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default Element.update()

    Element.update()


    There's a scoping problem in the script loading function.

    The code needs to be

    Code:
            var _parseScripts = function(){
                var s = this.dom.getElementsByTagName("script");
                var docHead = document.getElementsByTagName("head")[0];
                
                //   For browsers which discard scripts when inserting innerHTML, extract the scripts using a RegExp
                if(s.length == 0){
                    var re = /(?:<script.*(?:src=[\"\'](.*)[\"\']).*>.*<\/script>)|(?:<script.*>([\S\s]*?)<\/script>)/ig; // assumes HTML well formed and then loop through it.
                    var match;
                    while(match = re.exec(html)){
                         var s0 = document.createElement("script");
                         if (match[1])
                            s0.src = match[1];
                         else if (match[2])
                            s0.text = match[2];
                         else
                              continue;
                         docHead.appendChild(s0);
                    }
                }else {
                  for(var i = 0; i < s.length; i++){
                     var s0 = document.createElement("script");
                     s0.type = s[i].type;
                     if (s[i].text) {
                        s0.text = s[i].text;
                     } else {
                        s0.src = s[i].src;
                     }
                     docHead.appendChild(s0);
                  }
                }
            }.createDelegate(this);
    That createDelegate function is a fantastic addition. It helps so much when using DWR callbacks!

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      0  

    Default


    Thanks for reporting this. I just removed the reference to this since it wasn't needed.

    var dom = this.dom; <-- local variable gets closured
    var _parseScripts = function(){
    var s = dom.getElementsByTagName("script");

Similar Threads

  1. Element.update() && styles
    By vtswingkid in forum Ext 1.x: Bugs
    Replies: 11
    Last Post: 21 Jun 2007, 5:29 AM
  2. Element.update() and loadScripts...
    By Animal in forum Ext 1.x: Bugs
    Replies: 11
    Last Post: 20 Apr 2007, 3:38 PM
  3. Element.js -- update bugs
    By vtswingkid in forum Ext 1.x: Bugs
    Replies: 7
    Last Post: 17 Nov 2006, 5:03 AM

Thread Participants: 1