Ticket #4767: 4767_2.patch

File 4767_2.patch, 2.6 KB (added by Minh Nguyen, 14 years ago)

Remove loadPending method

  • _source/core/loader.js

     
    124124                                't=' + timestamp;
    125125                };
    126126
    127                 var pendingLoad = [];
    128 
    129127                /** @lends CKEDITOR.loader */
    130128                return {
    131129                        /**
     
    137135                         */
    138136                        loadedScripts : [],
    139137
    140                         loadPending : function()
    141                         {
    142                                 var scriptName = pendingLoad.shift();
    143 
    144                                 if ( !scriptName )
    145                                         return;
    146 
    147                                 var scriptSrc = getUrl( '_source/' + scriptName + '.js' );
    148 
    149                                 var script = document.createElement( 'script' );
    150                                 script.type = 'text/javascript';
    151                                 script.src = scriptSrc;
    152 
    153                                 function onScriptLoaded()
    154                                 {
    155                                         // Append this script to the list of loaded scripts.
    156                                         CKEDITOR.loader.loadedScripts.push( scriptName );
    157 
    158                                         // Load the next.
    159                                         CKEDITOR.loader.loadPending();
    160                                 }
    161 
    162                                 // We must guarantee the execution order of the scripts, so we
    163                                 // need to load them one by one. (#4145)
    164                                 // The followin if/else block has been taken from the scriptloader core code.
    165                                 if ( CKEDITOR.env.ie )
    166                                 {
    167                                         /** @ignore */
    168                                         script.onreadystatechange = function()
    169                                         {
    170                                                 if ( script.readyState == 'loaded' || script.readyState == 'complete' )
    171                                                 {
    172                                                         script.onreadystatechange = null;
    173                                                         onScriptLoaded();
    174                                                 }
    175                                         };
    176                                 }
    177                                 else
    178                                 {
    179                                         /** @ignore */
    180                                         script.onload = function()
    181                                         {
    182                                                 // Some browsers, such as Safari, may call the onLoad function
    183                                                 // immediately. Which will break the loading sequence. (#3661)
    184                                                 setTimeout( function() { onScriptLoaded( scriptName ); }, 0 );
    185                                         };
    186                                 }
    187 
    188                                 document.body.appendChild( script );
    189                         },
    190 
    191138                        /**
    192139                         * Loads a specific script, including its dependencies. This is not a
    193140                         * synchronous loading, which means that the code the be loaded will
     
    215162                                        this.load( dependencies[ i ], true );
    216163
    217164                                var scriptSrc = getUrl( '_source/' + scriptName + '.js' );
    218 
    219                                 // Append the <script> element to the DOM.
    220                                 if ( document.body )
    221                                 {
    222                                         pendingLoad.push( scriptName );
    223 
    224                                         if ( !defer )
    225                                                 this.loadPending();
    226                                 }
    227                                 else
    228                                 {
    229                                         // Append this script to the list of loaded scripts.
    230                                         this.loadedScripts.push( scriptName );
    231 
    232                                         document.write( '<script src="' + scriptSrc + '" type="text/javascript"><\/script>' );
    233                                 }
     165                               
     166                                // load script.
     167                                document.write( '<script src="' + scriptSrc + '" type="text/javascript"><\/script>' );
    234168                        }
    235169                };
    236170        })();
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy