wikibits.js: Support multiple parameter in document.write
authorFomafix <fomafix@googlemail.com>
Sat, 8 Aug 2015 20:57:25 +0000 (20:57 +0000)
committerOri.livneh <ori@wikimedia.org>
Tue, 11 Aug 2015 21:48:04 +0000 (21:48 +0000)
document.write and document.writeln supports multiple arguments:
http://www.w3.org/html/wg/drafts/html/CR/webappapis.html#document.write%28%29

Support this in the replacement code.

Change-Id: I0ffc51352278d434d8347502c778b16b34c7d73f

resources/src/mediawiki.legacy/wikibits.js

index 05954ff..b5720a4 100644 (file)
        // Replace document.write/writeln with basic html parsing that appends
        // to the <body> to avoid blanking pages. Added JavaScript will not run.
        $.each( [ 'write', 'writeln' ], function ( idx, method ) {
-               mw.log.deprecate( document, method, function ( html ) {
-                       $( 'body' ).append( $.parseHTML( html ) );
+               mw.log.deprecate( document, method, function () {
+                       $( 'body' ).append( $.parseHTML( Array.prototype.join.call( arguments, '' ) ) );
                }, 'Use jQuery or mw.loader.load instead.' );
        } );