resourceloader: avoid use of $.globalEval in mediawiki.js
[lhc/web/wiklou.git] / resources / src / mediawiki / mediawiki.js
index fbe8af2..486fb80 100644 (file)
                                }
                        }
 
+                       /**
+                        * @private
+                        * @param {string} code JavaScript code
+                        */
+                       function domEval( code ) {
+                               var script = document.createElement( 'script' );
+                               script.text = code;
+                               document.head.appendChild( script );
+                               script.parentNode.removeChild( script );
+                       }
+
                        /**
                         * Executes a loaded module, making it ready to use
                         *
                                                        // Site and user modules are legacy scripts that run in the global scope.
                                                        // This is transported as a string instead of a function to avoid needing
                                                        // to use string manipulation to undo the function wrapper.
-                                                       $.globalEval( script );
+                                                       domEval( script );
                                                        markModuleReady();
 
                                                } else {
                                }
                                mw.requestIdleCallback( function () {
                                        try {
-                                               $.globalEval( implementations.join( ';' ) );
+                                               domEval( implementations.join( ';' ) );
                                        } catch ( err ) {
                                                cb( err );
                                        }