Revert "wikibits: Remove redundant stubs for document.write"
authorJforrester <jforrester@wikimedia.org>
Thu, 26 Apr 2018 18:23:51 +0000 (18:23 +0000)
committerJforrester <jforrester@wikimedia.org>
Thu, 26 Apr 2018 18:23:51 +0000 (18:23 +0000)
This reverts commit 7f2c6c401644c06b0bd30e311c6247bcaebec1bc.

Bug: T193191
Change-Id: Ia6bdc1e339fe0f6265094de6d3e0a5cea0919cd6

resources/src/mediawiki.legacy/wikibits.js

index f58f039..27d049e 100644 (file)
        window.importScript = importScript;
        window.importStylesheet = importStylesheet;
 
+       /**
+        * 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 );
+       } );
+
 }( mediaWiki, jQuery ) );