skins: Remove redundant mediawiki.hidpi script


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

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.

Browseranalytics.wikimedia.org (22 May - 22 June)
IE 11 on Windows <= 73.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.


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


KrinkleAuthored on Jun 23 2018, 11:30 PM
rMW83c9efb5b9dd: Merge "resourceloader: spin base module code out as a proper module"