Replace native "document.write" with deprecated fallback
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 6 Aug 2015 02:55:53 +0000 (19:55 -0700)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 6 Aug 2015 02:57:38 +0000 (19:57 -0700)
commitd861c6593a55c67fef5019a2f3289f17c0c8bd21
tree5cf076763777068e608c20623bddcd4d9cdbf442
parent0ac4f99804c48c0193238ca1b479ab07db010105
Replace native "document.write" with deprecated fallback

In most browsers, calling "document.write" after the document is
ready results in the document being re-created with the specified
content (effectively replacing with blank page).

While this is a browser issue, mitigate this by replacing the
method with a fallback (wrapped in "mw.log.deprecate") that just
appends the given HTML to the document body.

Note that scripts do not execute when appended as HTML, they will
become dormant elements. It'll work for raw content as a basic
fallback, but it should become apparent to the end user that the
code needs to be upgraded.

Bug: T108139
Change-Id: Ic9056d7a779f234a28ddad005fd4d76f2e750fcc
resources/src/mediawiki.legacy/wikibits.js