Merge "textSelection: Use execcommand to replace text"
[lhc/web/wiklou.git] / resources / src / mediawiki.legacy / wikibits.js
index f58f039..1e1c303 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * MediaWiki legacy wikibits
  */
-( function ( mw, $ ) {
+( function () {
        var msg,
                loadedScripts = {};
 
@@ -27,7 +27,9 @@
         * @deprecated since 1.17 Use jQuery instead
         */
        mw.log.deprecate( window, 'addOnloadHook', function ( fn ) {
-               $( function () { fn(); } );
+               $( function () {
+                       fn();
+               } );
        }, 'Use jQuery instead.' );
 
        /**
        window.importScript = importScript;
        window.importStylesheet = importStylesheet;
 
-}( mediaWiki, jQuery ) );
+       /**
+        * Replace document.write/writeln with basic html parsing that appends
+        * to the <body> to avoid blanking pages. Added JavaScript will not run.
+        *
+        * @deprecated since 1.26
+        */
+       [ 'write', 'writeln' ].forEach( function ( method ) {
+               mw.log.deprecate( document, method, function () {
+                       $( 'body' ).append( $.parseHTML( Array.prototype.join.call( arguments, '' ) ) );
+               }, 'Use jQuery or mw.loader.load instead.', 'document.' + method );
+       } );
+
+}() );