Merge pull request #180 from amire80/object-keys
Restore support for IE8
This commit is contained in:
@@ -354,13 +354,26 @@
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
getMenuWidth: function () {
|
getMenuWidth: function () {
|
||||||
var languagesCount;
|
var language,
|
||||||
|
languagesCount = 0;
|
||||||
|
|
||||||
if ( this.options.menuWidth ) {
|
if ( this.options.menuWidth ) {
|
||||||
return 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 ) {
|
if ( languagesCount < 12 ) {
|
||||||
return 'narrow';
|
return 'narrow';
|
||||||
|
|||||||
Reference in New Issue
Block a user