Restore support for IE8

IE8 does not support Object.keys.

Bug: T86516
Change-Id: Ib1a5df6c1660bc30f7b33f1b794a9229ce31cba6
This commit is contained in:
Fomafix
2015-01-12 10:54:22 +00:00
committed by [[mw:User:Fomafix]]
parent ee94df2890
commit c33ac5fdb4

View File

@@ -354,13 +354,25 @@
* @return string
*/
getMenuWidth: function () {
var languagesCount;
var language, languagesCount = 0;
if ( this.options.menuWidth ) {
return this.options.menuWidth;
}
// 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';