JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.1
[ckeditor.git] / _source / core / loader.js
index 92648a0..d8a8302 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -23,8 +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/ajax'                             : [ 'core/xml' ],\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/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
                        'core/ckeditor_basic'   : [ 'core/editor_basic', 'core/env', 'core/event' ],\r
@@ -41,6 +40,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
@@ -58,16 +58,14 @@ if ( !CKEDITOR.loader )
                        'core/htmlparser/cdata'         : [ 'core/htmlparser' ],\r
                        'core/htmlparser/filter'        : [ 'core/htmlparser' ],\r
                        'core/htmlparser/basicwriter': [ 'core/htmlparser' ],\r
-                       'core/imagecacher'              : [ 'core/dom/element' ],\r
                        'core/lang'                             : [],\r
                        'core/plugins'                  : [ 'core/resourcemanager' ],\r
                        'core/resourcemanager'  : [ 'core/scriptloader', 'core/tools' ],\r
                        'core/scriptloader'             : [ 'core/dom/element', 'core/env' ],\r
-                       'core/skins'                    : [ 'core/imagecacher', 'core/scriptloader' ],\r
+                       'core/skins'                    : [ 'core/scriptloader' ],\r
                        'core/themes'                   : [ 'core/resourcemanager' ],\r
                        'core/tools'                    : [ 'core/env' ],\r
-                       'core/ui'                               : [],\r
-                       'core/xml'                              : [ 'core/env' ]\r
+                       'core/ui'                               : []\r
                };\r
 \r
                var basePath = (function()\r
@@ -83,7 +81,7 @@ if ( !CKEDITOR.loader )
 \r
                        for ( var i = 0 ; i < scripts.length ; i++ )\r
                        {\r
-                               var match = scripts[i].src.match( /(^|.*[\\\/])core\/loader.js(?:\?.*)?$/i );\r
+                               var match = scripts[i].src.match( /(^|.*?[\\\/])(?:_source\/)?core\/loader.js(?:\?.*)?$/i );\r
 \r
                                if ( match )\r
                                {\r
@@ -107,7 +105,7 @@ if ( !CKEDITOR.loader )
                        return path;\r
                })();\r
 \r
-               var timestamp = 'A06B';\r
+               var timestamp = 'B5GJ5GG';\r
 \r
                var getUrl = function( resource )\r
                {\r
@@ -156,8 +154,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 +183,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 +210,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