Restore support for IE8

IE8 does not support Object.keys.

https://phabricator.wikimedia.org/T86516

Copying the patch from Gerrit:
https://gerrit.wikimedia.org/r/#/c/184316/
This commit is contained in:
Amir E. Aharoni
2015-01-27 10:16:13 -08:00
parent fe20552d31
commit b6a30c3d44

View File

@@ -354,13 +354,26 @@
* @return string
*/
getMenuWidth: function () {
var languagesCount;
var language,
languagesCount = 0;
if ( this.options.menuWidth ) {
return this.options.menuWidth;
}
languagesCount = Object.keys( this.options.languages ).length;
// IE8 does not support Object.keys
if ( Object.keys ) {
languagesCount = Object.keys( this.options.languages ).length;
} else {
for ( language in this.options.languages ) {
if ( Object.prototype.hasOwnProperty.call(
this.options.languages,
language
) ) {
languagesCount++;
}
}
}
if ( languagesCount < 12 ) {
return 'narrow';