aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.menu.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2012-04-02 19:12:21 -0400
committerScott González <scott.gonzalez@gmail.com>2012-04-02 19:12:21 -0400
commit639afa595465f6a1f61e080f2b671af4aac69b4a (patch)
treecab8f18e790d7646677ca0207d21025c9c708428 /ui/jquery.ui.menu.js
parent3e6877a892b8fb70f1130f639dfde09ce5af6236 (diff)
downloadjquery-ui-639afa595465f6a1f61e080f2b671af4aac69b4a.tar.gz
jquery-ui-639afa595465f6a1f61e080f2b671af4aac69b4a.zip
Lint fixes.
Diffstat (limited to 'ui/jquery.ui.menu.js')
-rw-r--r--ui/jquery.ui.menu.js42
1 files changed, 23 insertions, 19 deletions
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index 6d00f66ae..af22c19b0 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -85,9 +85,9 @@ $.widget( "ui.menu", {
"mouseleave": "collapseAll",
"mouseleave .ui-menu": "collapseAll",
"focus": function( event ) {
- var firstItem = this.element.children( ".ui-menu-item" ).not( ".ui-state-disabled" ).eq( 0 );
+ var menu = this.element,
+ firstItem = menu.children( ".ui-menu-item" ).not( ".ui-state-disabled" ).eq( 0 );
if ( this._hasScroll() && !this.active ) {
- var menu = this.element;
menu.children().each( function() {
var currentItem = $( this );
if ( currentItem.offset().top - menu.offset().top >= 0 ) {
@@ -183,7 +183,7 @@ $.widget( "ui.menu", {
character = String.fromCharCode( event.keyCode ),
skip = false;
- if (character == prev) {
+ if (character === prev) {
skip = true;
} else {
character = prev + character;
@@ -195,7 +195,7 @@ $.widget( "ui.menu", {
return new RegExp("^" + escape(character), "i")
.test( $( this ).children( "a" ).text() );
});
- match = skip && match.index(this.active.next()) != -1 ? this.active.nextAll(".ui-menu-item") : match;
+ match = skip && match.index(this.active.next()) !== -1 ? this.active.nextAll(".ui-menu-item") : match;
if ( !match.length ) {
character = String.fromCharCode(event.keyCode);
match = this.activeMenu.children(".ui-menu-item").filter( function() {
@@ -260,15 +260,18 @@ $.widget( "ui.menu", {
refresh: function() {
// initialize nested menus
- var submenus = this.element.find( this.options.menus + ":not( .ui-menu )" )
- .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
- .attr( "role", "menu" )
- .hide()
- .attr( "aria-hidden", "true" )
- .attr( "aria-expanded", "false" );
+ var menuId,
+ submenus = this.element.find( this.options.menus + ":not( .ui-menu )" )
+ .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
+ .hide()
+ .attr({
+ role: "menu",
+ "aria-hidden": "true",
+ "aria-expanded": "false"
+ });
// don't refresh list items that are already adapted
- var menuId = this.menuId;
+ menuId = this.menuId;
submenus.add( this.element ).children( ":not( .ui-menu-item ):has( a )" )
.addClass( "ui-menu-item" )
.attr( "role", "presentation" )
@@ -291,15 +294,16 @@ $.widget( "ui.menu", {
},
focus: function( event, item ) {
+ var nested, borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
this.blur( event );
if ( this._hasScroll() ) {
- var borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0,
- paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0,
- offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop,
- scroll = this.activeMenu.scrollTop(),
- elementHeight = this.activeMenu.height(),
- itemHeight = item.height();
+ borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
+ paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
+ offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
+ scroll = this.activeMenu.scrollTop();
+ elementHeight = this.activeMenu.height();
+ itemHeight = item.height();
if ( offset < 0 ) {
this.activeMenu.scrollTop( scroll + offset );
@@ -321,7 +325,7 @@ $.widget( "ui.menu", {
this._close();
}, this.delay );
- var nested = $( "> .ui-menu", item );
+ nested = $( "> .ui-menu", item );
if ( nested.length && ( /^mouse/.test( event.type ) ) ) {
this._startOpening(nested);
}
@@ -368,7 +372,7 @@ $.widget( "ui.menu", {
var position = $.extend({}, {
of: this.active
- }, $.type(this.options.position) == "function" ?
+ }, $.type(this.options.position) === "function" ?
this.options.position(this.active) :
this.options.position
);