Merge "Drop zh-tw message "saveprefs""
[lhc/web/wiklou.git] / resources / src / mediawiki / mediawiki.js
index af89b9a..5dd2acb 100644 (file)
                                // Add ready and error callbacks if they were given
                                if ( ready !== undefined || error !== undefined ) {
                                        jobs.push( {
+                                               // Narrow down the list to modules that are worth waiting for
                                                dependencies: $.grep( dependencies, function ( module ) {
                                                        var state = mw.loader.getState( module );
-                                                       return state === 'registered' || state === 'loaded' || state === 'loading';
+                                                       return state === 'registered' || state === 'loaded' || state === 'loading' || state === 'executing';
                                                } ),
                                                ready: ready,
                                                error: error
                                        if ( typeof modules !== 'object' && typeof modules !== 'string' ) {
                                                throw new Error( 'modules must be a string or an array, not a ' + typeof modules );
                                        }
-                                       // Allow calling with an external url or single dependency as a string
+                                       // Allow calling with a url or single dependency as a string
                                        if ( typeof modules === 'string' ) {
-                                               if ( /^(https?:)?\/\//.test( modules ) ) {
+                                               // "https://example.org/x.js", "http://example.org/x.js", "//example.org/x.js", "/x.js"
+                                               if ( /^(https?:)?\/?\//.test( modules ) ) {
                                                        if ( type === 'text/css' ) {
                                                                // Support: IE 7-8
                                                                // Use properties instead of attributes as IE throws security