Index: CKEditor/trunk/CHANGES.html
===================================================================
--- CKEditor/trunk/CHANGES.html	(revision 4018)
+++ CKEditor/trunk/CHANGES.html	(revision 4019)
@@ -217,4 +217,6 @@
 		<li><a href="http://dev.fckeditor.net/ticket/4143">#4143</a> : Fixed element id is lost when extracting contents from the range.</li>
 		<li><a href="http://dev.fckeditor.net/ticket/4007">#4007</a> : [IE] Source area overflow from editor chrome.</li>
+		<li><a href="http://dev.fckeditor.net/ticket/4145">#4145</a> : Fixed the on demand 
+			(&quot;basic&quot;) loading model of the editor.</li>
 	</ul>
 	<h3>
Index: CKEditor/trunk/_source/core/loader.js
===================================================================
--- CKEditor/trunk/_source/core/loader.js	(revision 4018)
+++ CKEditor/trunk/_source/core/loader.js	(revision 4019)
@@ -124,4 +124,6 @@
 		};
 
+		var pendingLoad = [];
+
 		/** @lends CKEDITOR.loader */
 		return {
@@ -134,4 +136,55 @@
 			 */
 			loadedScripts : [],
+			
+			loadPending : function()
+			{
+				var scriptName = pendingLoad.shift();
+				
+				if ( !scriptName )
+					return;
+
+				var scriptSrc = getUrl( '_source/' + scriptName + '.js' );
+
+				var script = document.createElement( 'script' );
+				script.type = 'text/javascript';
+				script.src = scriptSrc;
+
+				function onScriptLoaded()
+				{
+					// Append this script to the list of loaded scripts.
+					CKEDITOR.loader.loadedScripts.push( scriptName );
+					
+					// Load the next.
+					CKEDITOR.loader.loadPending();
+				}
+
+				// We must guarantee the execution order of the scripts, so we
+				// need to load them one by one. (#4145)
+				// The followin if/else block has been taken from the scriptloader core code.
+				if ( CKEDITOR.env.ie )
+				{
+					/** @ignore */
+					script.onreadystatechange = function()
+					{
+						if ( script.readyState == 'loaded' || script.readyState == 'complete' )
+						{
+							script.onreadystatechange = null;
+							onScriptLoaded();
+						}
+					};
+				}
+				else
+				{
+					/** @ignore */
+					script.onload = function()
+					{
+						// Some browsers, such as Safari, may call the onLoad function
+						// immediately. Which will break the loading sequence. (#3661)
+						setTimeout( function() { onScriptLoaded( scriptName ); }, 0 );
+					};
+				}
+
+				document.body.appendChild( script );
+			},
 
 			/**
@@ -142,5 +195,5 @@
 			 * CKEDITOR.loader.load( 'core/dom/element' );
 			 */
-			load : function( scriptName )
+			load : function( scriptName, defer )
 			{
 				// Check if the script has already been loaded.
@@ -159,9 +212,6 @@
 				// Load all dependencies first.
 				for ( var i = 0 ; i < dependencies.length ; i++ )
-					this.load( dependencies[ i ] );
-
-				// Append this script to the list of loaded scripts.
-				this.loadedScripts.push( scriptName );
-
+					this.load( dependencies[ i ], true );
+				
 				var scriptSrc = getUrl( '_source/' + scriptName + '.js' );
 
@@ -169,9 +219,8 @@
 				if ( document.body )
 				{
-					var script = document.createElement( 'script' );
-					script.type = 'text/javascript';
-					script.src = scriptSrc;
-
-					document.body.appendChild( script );
+					pendingLoad.push( scriptName );
+
+					if ( !defer )
+						this.loadPending();
 				}
 				else
Index: CKEditor/trunk/_source/tests/core/bootstrap.html
===================================================================
--- CKEditor/trunk/_source/tests/core/bootstrap.html	(revision 4018)
+++ CKEditor/trunk/_source/tests/core/bootstrap.html	(revision 4019)
@@ -12,4 +12,12 @@
 
 var before_loadFullCore = CKEDITOR.status;
+
+var isLoaded;
+
+CKEDITOR.on( 'loaded', function()
+	{
+		isLoaded = true;
+	});
+
 
 CKEDITOR.loadFullCore();
@@ -33,4 +41,8 @@
 		test_status2 : function()
 		{
+			// In IE, CKEDITOR.on( 'loaded' ) will be called immediately if the scripts are cached.
+			if ( isLoaded )
+				return;
+
 			var testCase = this;
 			CKEDITOR.on( 'loaded', function()
