Removes occurrence of elementsbyclassname.

This commit is contained in:
zorkow 2015-09-01 01:29:55 +01:00
parent ad8a8704d4
commit c890d8183d

View File

@ -732,15 +732,21 @@
this.MoveHorizontal(event, item, MENU.Left, this.isRTL()); this.MoveHorizontal(event, item, MENU.Left, this.isRTL());
}, },
MoveHorizontal: function(event, item, move, rtl) { MoveHorizontal: function(event, item, move, rtl) {
if (ITEM.GetMenuNode(item).menuItem === MENU.menu) { var menuNode = ITEM.GetMenuNode(item);
if (menuNode.menuItem === MENU.menu) {
move(event, item); move(event, item);
} }
if (rtl) { return; } if (rtl) { return; }
this.Deactivate(item); this.Deactivate(item);
var sibling = item.parentNode.previousSibling; var parentNodes = menuNode.previousSibling.childNodes;
var actives = sibling.getElementsByClassName('MathJax_MenuActive'); var length = parentNodes.length;
if (actives.length > 0) { while (length--) {
MENU.Focus(actives[0]); var parent = parentNodes[length];
if (parent.menuItem.submenu &&
parent.menuItem.submenu === menuNode.menuItem) {
MENU.Focus(parent);
break;
}
} }
this.RemoveSubmenus(item); this.RemoveSubmenus(item);
}, },