Changeset 13138

Show
Ignore:
Timestamp:
03/18/08 17:51:26 (10 months ago)
Author:
alex
Message:

clean patch for #5617 that avoids timer for all but IE 6. Fixes #5617. !strict

Files:
2 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/_editor/RichText.js

    r13093 r13138  
    330330                //if(typeof dojo.doc.body.contentEditable != "undefined"){ 
    331331                if(dojo.isIE || dojo.isSafari || dojo.isOpera){ // contentEditable, easy 
    332                         var ifr = this.iframe = dojo.doc.createElement('iframe'); 
    333                         ifr.id=this.id; 
    334                         ifr.src = 'javascript:void(0)'; 
    335                         this.editorObject = ifr; 
     332                        var burl = dojo.moduleUrl("dojo", "resources/blank.html")+""; 
     333                        var ifr = this.editorObject = this.iframe = dojo.doc.createElement('iframe'); 
     334                        ifr.id = this.id+"_iframe"; 
     335                        ifr.src = burl; 
    336336                        ifr.style.border = "none"; 
    337337                        ifr.style.width = "100%"; 
    338338                        ifr.frameBorder = 0; 
    339 //                      ifr.style.scrolling = this.height ? "auto" : "vertical"; 
     339                        // ifr.style.scrolling = this.height ? "auto" : "vertical"; 
    340340                        this.editingArea.appendChild(ifr); 
    341                         this.window = ifr.contentWindow; 
    342                         this.document = this.window.document; 
    343                         this.document.open(); 
    344                         this.document.write(this._getIframeDocTxt(html)); 
    345                         this.document.close(); 
    346  
    347                         if(dojo.isIE >= 7){ 
    348                                 if(this.height){ 
    349                                         ifr.style.height = this.height; 
     341                        var h = null; // set later in non-ie6 branch 
     342                        var loadFunc = dojo.hitch( this, function(){ 
     343                                if(h){ dojo.disconnect(h); h = null; } 
     344                                this.window = ifr.contentWindow; 
     345                                var d = this.document = this.window.document; 
     346                                d.open(); 
     347                                d.write(this._getIframeDocTxt(html)); 
     348                                d.close(); 
     349 
     350                                if(dojo.isIE >= 7){ 
     351                                        if(this.height){ 
     352                                                ifr.style.height = this.height; 
     353                                        } 
     354                                        if(this.minHeight){ 
     355                                                ifr.style.minHeight = this.minHeight; 
     356                                        } 
     357                                }else{ 
     358                                        ifr.style.height = this.height ? this.height : this.minHeight; 
    350359                                } 
    351                                 if(this.minHeight){ 
    352                                         ifr.style.minHeight = this.minHeight; 
     360 
     361                                if(dojo.isIE){ 
     362                                        this._localizeEditorCommands(); 
    353363                                } 
    354                         }else{ 
    355                                 ifr.style.height = this.height ? this.height : this.minHeight; 
    356                         } 
    357  
    358                         if(dojo.isIE){ 
    359                                 this._localizeEditorCommands(); 
    360                         } 
    361  
    362                         this.onLoad(); 
    363                         this.savedContent = this.getValue(true); 
     364 
     365                                this.onLoad(); 
     366                                this.savedContent = this.getValue(true); 
     367                        }); 
     368                        if(dojo.isIE && dojo.isIE < 7){ // IE 6 is a steaming pile... 
     369                                var t = setInterval(function(){ 
     370                                        if(ifr.contentWindow.isLoaded){ 
     371                                                clearInterval(t); 
     372                                                loadFunc(); 
     373                                        } 
     374                                }, 100); 
     375                        }else{ // blissful sanity! 
     376                                h = dojo.connect( 
     377                                        ((dojo.isIE) ? ifr.contentWindow : ifr), "onload", loadFunc 
     378                                ); 
     379                        } 
    364380                }else{ // designMode in iframe 
    365381                        this._drawIframe(html); 
  • dojo/trunk/resources/blank.html

    r9145 r13138  
    1 <html><head></head><body></body></html> 
     1<html><head><script>isLoaded = true;</script></head><body></body></html>