skins: Remove redundant mediawiki.hidpi script
authorTimo Tijhof <krinklemail@gmail.com>
Sat, 23 Jun 2018 23:30:18 +0000 (00:30 +0100)
committerKrinkle <krinklemail@gmail.com>
Mon, 25 Jun 2018 17:17:16 +0000 (17:17 +0000)
commit828f6d6ac9db63bd5ac56f6d7470f4568d6ec09d
tree5bed2c1d630b56614a6c24ae06a2cb4857306abb
parent83c9efb5b9ddf52163c77dedaa710db3a3ec9d80
skins: Remove redundant mediawiki.hidpi script

This is an internal script automatically loaded by Skin.php to
activate the 'jquery.hidpi' polyfill for all images on the current
page in browsers that don't natively support the 'srcset' attribute
on the HTML img element.

This script is loaded via ResourceLoader for which Grade A currently
requires:
> IE11+/Edge, Chr 65+, Ff 52+, Saf 5+, Op 15+, iOS 6+, Android 4+.

According to MDN and CanIUse, the basic 'x' syntax of srcset is supported, and
enabled by default, in:
> Edge, Chr 34+, Ff 38+, Saf 7+, Op 21+, iOS 8+, Android 5+.

This means in the following browsers, MediaWiki will no longer attempt to
replace images in articles with their hidpi versions.

| Browser                | analytics.wikimedia.org (22 May - 22 June)
| ---------------------- | -----------------------
| IE 11 on Windows <= 7  | 3.4% (OS does not support HiDPI)
| IE 11 on Windows 8+    | 1.1%
| Safari 5 & 6 (desktop) | <0.1%
| Opera 15-20 (desktop)  | <0.1%
| iOS 6 & 7 (mobile)     | 0.1%
| Android 4 (mobile)     | 0.5%

While the total of 1.7% is higher than our usual point where we decide
to remove support, I think we should consider dropping the hidpi polyfill
still for several reasons:

* MobileFrontend no longer uses 'srcset' attributes. As such, these browsers
  don't actually change their behaviour based on the polyfill.

* For IE 11/Win8 in particular, most users don't have an HiDPI monitor,
  but we still download the polyfill. HiDPI on Win8 is primarily tablets.

* In all cases where the polyfill activates, we download the HiDPI images
  in addition to the standard resolution (which downloads and renders first).
  This is because client-side JavaScript is not able to replace it sooner.
  This could be considered a waste of bandwidth, as it can double or tripple
  the bandwidth cost for end users.
  This also means pages complete their loading much later because the browser
  first renders the page nearly to completion with standard resolution images,
  and only at the end our polyfill activates to restarts all image loading.

The experience gracefully falls back to normal web rendering, where the standard
resolution of the image is used. This would match what users of these devices
see on other websites, given client-side emulation of srcset is fairly rare.

== Modules

The 'mediawiki.hidpi' module was removed, and considered internal to Skin.php.
It contained no public methods. I confirmed there were no matches in Codesearch,
and no matches in mwgrep on Wikimedia wikis.

I did not remove 'jquery.hidpi', which is what contains the actual polyfill
and the jQuery.fn.hidpi() public method. (Codesearch shows 2 extenisons using
it, and mwgrep returned 1 unused gadget on Meta-Wiki referencing it).
It has been kept, but marked as deprecated. To be removed in a future release.

Bug: T127328
Change-Id: I42ce0feea1fbfe534f00e05a7cd8d81df0c33d8f
Gruntfile.js
RELEASE-NOTES-1.32
includes/DefaultSettings.php
includes/skins/Skin.php
resources/Resources.php
resources/src/mediawiki.hidpi/hidpi.js [deleted file]
resources/src/mediawiki.hidpi/skip.js [deleted file]