JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.1.1
[ckeditor.git] / _source / core / loader.js
index 92648a0..ccc9701 100644 (file)
@@ -107,7 +107,7 @@ if ( !CKEDITOR.loader )
                        return path;\r
                })();\r
 \r
-               var timestamp = 'A06B';\r
+               var timestamp = 'A1QD';\r
 \r
                var getUrl = function( resource )\r
                {\r
@@ -156,8 +156,8 @@ if ( !CKEDITOR.loader )
 \r
                                // We must guarantee the execution order of the scripts, so we\r
                                // need to load them one by one. (#4145)\r
-                               // The followin if/else block has been taken from the scriptloader core code.\r
-                               if ( CKEDITOR.env.ie )\r
+                               // The following if/else block has been taken from the scriptloader core code.\r
+                               if ( typeof(script.onreadystatechange) !== "undefined" )\r
                                {\r
                                        /** @ignore */\r
                                        script.onreadystatechange = function()\r
@@ -185,7 +185,7 @@ if ( !CKEDITOR.loader )
 \r
                        /**\r
                         * Loads a specific script, including its dependencies. This is not a\r
-                        * synchronous loading, which means that the code the be loaded will\r
+                        * synchronous loading, which means that the code to be loaded will\r
                         * not necessarily be available after this call.\r
                         * @example\r
                         * CKEDITOR.loader.load( 'core/dom/element' );\r
@@ -212,7 +212,10 @@ if ( !CKEDITOR.loader )
                                var scriptSrc = getUrl( '_source/' + scriptName + '.js' );\r
 \r
                                // Append the <script> element to the DOM.\r
-                               if ( document.body )\r
+                               // If the page is fully loaded, we can't use document.write\r
+                               // but if the script is run while the body is loading then it's safe to use it\r
+                               // Unfortunately, Firefox <3.6 doesn't support document.readyState, so it won't get this improvement\r
+                               if ( document.body && (!document.readyState || document.readyState == 'complete') )\r
                                {\r
                                        pendingLoad.push( scriptName );\r
 \r