Ticket #4145: 4145.patch
File 4145.patch, 4.4 KB (added by , 15 years ago) |
---|
-
_source/core/loader.js
123 123 't=' + timestamp; 124 124 }; 125 125 126 var pendingLoad = []; 127 126 128 /** @lends CKEDITOR.loader */ 127 129 return { 128 130 /** … … 133 135 * alert( <b>CKEDITOR.loader.loadedScripts</b> ); 134 136 */ 135 137 loadedScripts : [], 138 139 loadPending : function() 140 { 141 var scriptName = pendingLoad.shift(); 142 143 if ( !scriptName ) 144 return; 136 145 146 var scriptSrc = getUrl( '_source/' + scriptName + '.js' ); 147 148 var script = document.createElement( 'script' ); 149 script.type = 'text/javascript'; 150 script.src = scriptSrc; 151 152 function onScriptLoaded() 153 { 154 // Append this script to the list of loaded scripts. 155 CKEDITOR.loader.loadedScripts.push( scriptName ); 156 157 // Load the next. 158 CKEDITOR.loader.loadPending(); 159 } 160 161 // We must guarantee the execution order of the scripts, so we 162 // need to load them one by one. (#4145) 163 // The followin if/else block has been taken from the scriptloader core code. 164 if ( CKEDITOR.env.ie ) 165 { 166 /** @ignore */ 167 script.onreadystatechange = function() 168 { 169 if ( script.readyState == 'loaded' || script.readyState == 'complete' ) 170 { 171 script.onreadystatechange = null; 172 onScriptLoaded(); 173 } 174 }; 175 } 176 else 177 { 178 /** @ignore */ 179 script.onload = function() 180 { 181 // Some browsers, such as Safari, may call the onLoad function 182 // immediately. Which will break the loading sequence. (#3661) 183 setTimeout( function() { onScriptLoaded( scriptName ); }, 0 ); 184 }; 185 } 186 187 document.body.appendChild( script ); 188 }, 189 137 190 /** 138 191 * Loads a specific script, including its dependencies. This is not a 139 192 * synchronous loading, which means that the code the be loaded will … … 141 194 * @example 142 195 * CKEDITOR.loader.load( 'core/dom/element' ); 143 196 */ 144 load : function( scriptName )197 load : function( scriptName, defer ) 145 198 { 146 199 // Check if the script has already been loaded. 147 200 if ( scriptName in this.loadedScripts ) … … 158 211 159 212 // Load all dependencies first. 160 213 for ( var i = 0 ; i < dependencies.length ; i++ ) 161 this.load( dependencies[ i ] ); 162 163 // Append this script to the list of loaded scripts. 164 this.loadedScripts.push( scriptName ); 165 214 this.load( dependencies[ i ], true ); 215 166 216 var scriptSrc = getUrl( '_source/' + scriptName + '.js' ); 167 217 168 218 // Append the <script> element to the DOM. 169 219 if ( document.body ) 170 220 { 171 var script = document.createElement( 'script' ); 172 script.type = 'text/javascript'; 173 script.src = scriptSrc; 221 pendingLoad.push( scriptName ); 174 222 175 document.body.appendChild( script ); 223 if ( !defer ) 224 this.loadPending(); 176 225 } 177 226 else 178 227 document.write( '<script src="' + scriptSrc + '" type="text/javascript"><\/script>' ); -
_source/tests/core/bootstrap.html
12 12 13 13 var before_loadFullCore = CKEDITOR.status; 14 14 15 var isLoaded; 16 17 CKEDITOR.on( 'loaded', function() 18 { 19 isLoaded = true; 20 }); 21 22 15 23 CKEDITOR.loadFullCore(); 16 24 17 25 //]]> … … 32 40 33 41 test_status2 : function() 34 42 { 43 // In IE, CKEDITOR.on( 'loaded' ) will be called immediately if the scripts are cached. 44 if ( isLoaded ) 45 return; 46 35 47 var testCase = this; 36 48 CKEDITOR.on( 'loaded', function() 37 49 { -
CHANGES.html
213 213 <li><a href="http://dev.fckeditor.net/ticket/4123">#4123</a> : Some dialog buttons were broken in IE7 quirks.</li> 214 214 <li><a href="http://dev.fckeditor.net/ticket/4122">#4122</a> : [IE] The image dialog 215 215 was being rendered improperly when loading an image with long URL.</li> 216 <li><a href="http://dev.fckeditor.net/ticket/4145">#4145</a> : Fixed the on demand 217 ("basic") loading model of the editor.</li> 216 218 </ul> 217 219 <h3> 218 220 CKEditor 3.0 RC</h3>