Preable
Wikimedia wikis page views (February 2016):
Total | Grade A | Grade X | Grade C |
---|---|---|---|
100.00% | 86.27% | 9.16% | 4.58% |
16002 M | 13804 M | 1465 M | 732 M |
- Grade C: Browsers we've identified as not supporting our JavaScript run time. Officially supported, as noscript. (e.g. IE 8, Opera Mini)
- Grade A: Browsers passing the startup sniffer, get JS, and we officially support them. (e.g. Chrome, IE9+)
- Grade X: Browsers passing the startup sniffer, get JS, but we don't officially support them (e.g. Iceweasel, UC Browser, Yandex).
There is no technical distinction made between Grade A and X. Just that we don't regularly test in Grade X browsers, nor prioritise issues specific to those. More details at https://www.mediawiki.org/wiki/Compatibility#Browsers.
We currently split between Grade C and Grade A+X by sniffing for Grade C user agent strings. This blacklist is getting rather long. Once upon a time it was just IE <= 5, but it's grown much larger since. (see startup.js#isCompatible)
Reasons
Converting to a feature test would:
- ... shrink this critical code path (T127328).
- ... make it more maintainable.
- ... give the blacklist a lot more meaning. Allowing us to confidently use features without conditionals or theoretical fallbacks.
- ... older versions of browsers that we no longer support will automatically fall in the right category.
A small set of feature tests would effectively cut Grade C the same way as our user agent sniffer. It would also make it easier to, in the future, turn off javascript for non-ES5 browsers by simply adding a one-line feature test for it.
This article about BBC web developers "cutting the mustard" reminded me of the important of feature detection:
http://responsivenews.co.uk/post/18948466399/cutting-the-mustard