aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.menu.js
diff options
context:
space:
mode:
authorkborchers <kris.borchers@gmail.com>2012-05-29 20:59:03 -0500
committerkborchers <kris.borchers@gmail.com>2012-05-29 21:13:45 -0500
commitd44f3d079e1a5976333afe56d104d03ba00a901b (patch)
tree0b4b681af85c8ead2979ed64ef8ef1ac96d650db /ui/jquery.ui.menu.js
parent40e47c0b08c31e5003833b9c46d36e7468a63de8 (diff)
downloadjquery-ui-d44f3d079e1a5976333afe56d104d03ba00a901b.tar.gz
jquery-ui-d44f3d079e1a5976333afe56d104d03ba00a901b.zip
Menu: Use new uniqueId and removeUniqueId methods for generating id's on menus and menu items and for removing those id's during destroy. Also, properly remove the aria-disabled attribute during destroy.
Diffstat (limited to 'ui/jquery.ui.menu.js')
-rw-r--r--ui/jquery.ui.menu.js18
1 files changed, 8 insertions, 10 deletions
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index 8d28ee82f..54a85abf5 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -13,8 +13,7 @@
*/
(function($) {
-var idIncrement = 0,
- currentEventTarget = null;
+var currentEventTarget = null;
$.widget( "ui.menu", {
version: "@VERSION",
@@ -35,12 +34,11 @@ $.widget( "ui.menu", {
},
_create: function() {
this.activeMenu = this.element;
- this.menuId = this.element.attr( "id" ) || "ui-menu-" + idIncrement++;
this.element
+ .uniqueId()
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
.attr({
- id: this.menuId,
role: this.options.role,
tabIndex: 0
})
@@ -145,18 +143,21 @@ $.widget( "ui.menu", {
.removeAttr( "aria-labelledby" )
.removeAttr( "aria-expanded" )
.removeAttr( "aria-hidden" )
+ .removeAttr( "aria-disabled" )
+ .removeUniqueId()
.show();
// destroy menu items
this.element.find( ".ui-menu-item" )
.removeClass( "ui-menu-item" )
.removeAttr( "role" )
+ .removeAttr( "aria-disabled" )
.children( "a" )
+ .removeUniqueId()
.removeClass( "ui-corner-all ui-state-hover" )
.removeAttr( "tabIndex" )
.removeAttr( "role" )
.removeAttr( "aria-haspopup" )
- .removeAttr( "id" )
// TODO: is this correct? Don't these exist in the original markup?
.children( ".ui-icon" )
.remove();
@@ -273,7 +274,6 @@ $.widget( "ui.menu", {
refresh: function() {
// initialize nested menus
var menus,
- menuId = this.menuId,
submenus = this.element.find( this.options.menus + ":not(.ui-menu)" )
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
.hide()
@@ -290,13 +290,11 @@ $.widget( "ui.menu", {
.addClass( "ui-menu-item" )
.attr( "role", "presentation" )
.children( "a" )
+ .uniqueId()
.addClass( "ui-corner-all" )
.attr({
tabIndex: -1,
- role: this._itemRole(),
- id: function( i ) {
- return menuId + "-" + i;
- }
+ role: this._itemRole()
});
// initialize unlinked menu-items containing spaces and/or dashes only as dividers