Skip to content

Commit

Permalink
Use jQuery < 1.7 compatible syntax for removeAttr. Fixes issues leavi…
Browse files Browse the repository at this point in the history
…ng small mode.
  • Loading branch information
gauthierm committed Jun 15, 2012
1 parent f20a94b commit 7945dbe
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions media/js/tabzilla.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,10 @@ Tabzilla.leaveSmallMode = function()
{
// remove focusability from menu headers
jQuery('#tabzilla-nav h2')
.removeAttr(
'role tabindex aria-haspopup aria-expanded'
)
.removeAttr('role')
.removeAttr('tabindex')
.removeAttr('aria-haspopup')
.removeAttr('aria-expanded')
.each(function(i, e) {
var $menu = jQuery(e).siblings('ul');
var $item = jQuery(e);
Expand All @@ -448,11 +449,19 @@ Tabzilla.initSubmenu = function($item, $menu)
$item.click(function(e) {
Tabzilla.toggleSubmenu($item, $menu);
});
$item.keypress(function(e) {
if (e.which === 13 || e.which === 39) {
$item.keyup(function(e) {
if (e.keyCode === 13) {
Tabzilla.preventDefault(e);
Tabzilla.toggleSubmenu($item, $menu);
}
if (e.keyCode === 39) {
Tabzilla.preventDefault(e);
Tabzilla.openSubmenu($item, $menu);
}
if (e.keyCode === 37) {
Tabzilla.preventDefault(e);
Tabzilla.closeSubmenu($item, $menu);
}
});
$menu.attr('role', 'menu');

Expand All @@ -468,7 +477,8 @@ Tabzilla.denitSubmenu = function($item, $menu)

var $items = $menu.find('a');
$items
.removeAttr('role tabindex')
.removeAttr('role')
.removeAttr('tabindex')
.unbind('keypress');
};

Expand Down

0 comments on commit 7945dbe

Please sign in to comment.