Really note the effects of inaction...
I think this announcement is missing one important tidbit:
If you have `document.write(…)` anywhere in your user JavaScript, **you
will get a blank page** on all pages of your wiki *, including the user
JavaScript page you'd have to edit to fix it, until you disable JavaScript
in your browser or ask an administrator to fix it for you.
If you have `document.write(…)` anywhere in the site JavaScript, **all
users** will **get a blank page** on all pages of the wiki *, including
anonymous readers, including all administrators who could fix it, until
one of them disables JavaScript in their browser, and finds and fixes the
broken script.
* Except for Special:Preferences and password-related pages, where user
and site JavaScript is disabled for security reasons.
On Thu, 06 Aug 2015 01:24:03 +0200, Krinkle <
krinklemail@gmail.com> wrote:
> TL:DR; Double-check your wiki's site scripts and your personal scripts
> to ensure "document.write" is no longer used.
>
> Hey all,
>
> We have strongly discouraged for many years the use of synchronous
> "document.write()" to inject additional HTML into the output stream.
> Across MediaWiki core, extensions, and gadgets this hasn't worked since
> 2012.
> With two legacy exceptions: the 'site' and 'user' modules. We always
> found a way
> to continue support for those. But this is now going to be removed.
>
> In upcoming ResourceLoader upgrades and performance improvements, we will
> cease support for synchronous document-write, in the site and user
> modules.
> Use of document-write requires MediaWiki to instruct the browser to
> pause its
> rendering before the browser may proceed to parse and display a page to
> users.
>
> Even though most scripts don't use this feature, the mere fact that we
> support it
> is causing a measurable impact on page load performance.
>
> Starting in 1.26wmf17 (released to wikis this week), ResourceLoader will
> be
> fully asynchronous. This change is already live on the Beta Cluster. [1]
> This means it is no longer possible for the site and user scripts to,
> with
> document-write, pause the browser execution and insert additional HTML in
> the initial output stream.
>
> Removing an API does not necessarily mean removing a capability. If you
> encounter any issues or can't find a simple upgrade path for an existing
> script, please reach out on the mailing list. Below is summary of a few
> typical use cases:
>
> 1. Loading scripts.
>
> Instead of `document.write("<script src=url></script>");`
> use `mw.loader.load(url);` instead.
>
> 2. Loading stylesheets.
>
> Instead of `document.write("<link rel=stylesheet href=url/>");`
> use `mw.loader.load(url, "text/css");` instead.
>
> 3. Creating elements.
>
> Instead of `document.write("<div>....</div>");`, use:
>
> var nodes = $.parseHTML("<div>..</div>"); $('body').append(nodes);
>
> Or something like:
>
> $("<div>").attr({ "id": "foo" }).appendTo("body");
>
>
> Please take some time to look through your wiki's site scripts
> (MediaWiki:Common.js,
> MediaWiki:Vector.js, etc.) and make sure document-write is no longer
> used.
> You can also use the search engine. For example:
>
>
https://nl.wikipedia.org/w/index.php?search=document.write&ns8=1
>
https://commons.wikimedia.org/w/index.php?search=document.write&ns8=1
>
> Search results from mwgrep on all public wikis:
>
https://phabricator.wikimedia.org/P1832
>
> Check out the migration page for other deprecations and common issues
> you may encounter:
>
https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_(users)
>
> == Further reading ==
>
> The ResourceLoader improvements that led to this change are tracked under
>
https://phabricator.wikimedia.org/T107399.
>
> Refer to the following workboards for other tasks in this area:
>
https://phabricator.wikimedia.org/tag/mediawiki-resourceloader/board/?order=priority
>
https://phabricator.wikimedia.org/tag/performance-team/board/?order=priority
>
> Now that the site and user modules are primary citizens in the
> ResourceLoader landscape,
> their states can be tracked with mw.loader. This solves long-outstanding
> issues such as
>
https://phabricator.wikimedia.org/T106736 which sometimes caused
> malfunctions
> in Common.js to affect user gadgets, VisualEditor, and other site tools.
>
> — Krinkle
>
> [1]
http://en.wikipedia.beta.wmflabs.org/
>
>
> _______________________________________________
> Wikitech-ambassadors mailing list
>
Wikitech-ambassadors@lists.wikimedia.org
>
https://lists.wikimedia.org/mailman/listinfo/wikitech-ambassadors
--
Bartosz Dziewoński
_______________________________________________
Wikitech-ambassadors mailing list
Wikitech-ambassadors@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-ambassadors