JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.4
[ckeditor.git] / _source / core / loader.js
index 92648a0..2e23d7e 100644 (file)
@@ -23,7 +23,7 @@ if ( !CKEDITOR.loader )
                // Table of script names and their dependencies.\r
                var scripts =\r
                {\r
-                       'core/_bootstrap'               : [ 'core/config', 'core/ckeditor', 'core/plugins', 'core/scriptloader', 'core/tools', /* The following are entries that we want to force loading at the end to avoid dependence recursion */ 'core/dom/comment', 'core/dom/elementpath', 'core/dom/text', 'core/dom/range' ],\r
+                       'core/_bootstrap'               : [ 'core/config', 'core/ckeditor', 'core/plugins', 'core/scriptloader', 'core/tools', /* The following are entries that we want to force loading at the end to avoid dependence recursion */ 'core/dom/comment', 'core/dom/elementpath', 'core/dom/text', 'core/dom/rangelist' ],\r
                        'core/ajax'                             : [ 'core/xml' ],\r
                        'core/ckeditor'                 : [ 'core/ckeditor_basic', 'core/dom', 'core/dtd', 'core/dom/document', 'core/dom/element', 'core/editor', 'core/event', 'core/htmlparser', 'core/htmlparser/element', 'core/htmlparser/fragment', 'core/htmlparser/filter', 'core/htmlparser/basicwriter', 'core/tools' ],\r
                        'core/ckeditor_base'    : [],\r
@@ -41,6 +41,7 @@ if ( !CKEDITOR.loader )
                        'core/dom/nodelist'             : [ 'core/dom/node' ],\r
                        'core/dom/domobject'    : [ 'core/dom/event' ],\r
                        'core/dom/range'                : [ 'core/dom/document', 'core/dom/documentfragment', 'core/dom/element', 'core/dom/walker' ],\r
+                       'core/dom/rangelist'    : [ 'core/dom/range' ],\r
                        'core/dom/text'                 : [ 'core/dom/node', 'core/dom/domobject' ],\r
                        'core/dom/walker'               : [ 'core/dom/node' ],\r
                        'core/dom/window'               : [ 'core/dom/domobject' ],\r
@@ -107,7 +108,7 @@ if ( !CKEDITOR.loader )
                        return path;\r
                })();\r
 \r
-               var timestamp = 'A06B';\r
+               var timestamp = 'A7HG4HT';\r
 \r
                var getUrl = function( resource )\r
                {\r
@@ -156,8 +157,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 +186,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 +213,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