Skip to content
Permalink
Browse files

JSCS: Disallow "else" keyword on newline

  • Loading branch information...
nschonni committed Dec 2, 2013
1 parent 21da746 commit 6b0b29c79a0abc9aff2225ae904ca4ab2dc2b16a
Showing with 15 additions and 24 deletions.
  1. +3 −0 .jscs.json
  2. +3 −6 src/core/helpers.js
  3. +9 −18 src/polyfills/datalist/datalist.js
@@ -63,6 +63,9 @@
"with"
],
"disallowMultipleLineBreaks": true,
"disallowKeywordsOnNewLine": [
"else"
],
"requireLineFeedAtFileEnd": true,
"validateJSDoc": {
"checkParamNames": true,
@@ -195,11 +195,9 @@

if ( methods[ method ] ) {
methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ) );
}
else if ( typeof method === "object" || !method ) {
} else if ( typeof method === "object" || !method ) {
methods.init.apply( this, arguments );
}
else {
} else {
$.error( "Method " + method + " does not exist on jquery.wb" );
}
};
@@ -231,8 +229,7 @@
isTabIndexNotNaN ) &&
// the element and all of its ancestors must be visible
visible( element );
}
else {
} else {
return ( /input|select|textarea|button|object/.test( nodeName ) ? !element.disabled :
"a" === nodeName ?
element.href || isTabIndexNotNaN :
@@ -144,20 +144,18 @@ var selector = "input[list]",
if ( !event.altKey ) {
showOptions( input, input.value + String.fromCharCode( which ) );
}
}

// Backspace
else if ( which === 8 && !event.altKey ) {
} else if ( which === 8 && !event.altKey ) {
value = input.value;
len = value.length;

if ( len !== 0 ) {
showOptions( input, value.substring( 0, len - 1 ) );
}
}

// Up / down arrow
else if ( ( which === 38 || which === 40) && input.getAttribute( "aria-activedescendent" ) === "" ) {
} else if ( ( which === 38 || which === 40) && input.getAttribute( "aria-activedescendent" ) === "" ) {
if ( _alHide ) {
showOptions( input );
}
@@ -171,9 +169,7 @@ var selector = "input[list]",
$( dest ).trigger( "setfocus.wb" );

return false;
}

else if ( !_alHide ) {
} else if ( !_alHide ) {

// Tab or Escape key
if ( ( which === 9 || which === 27 ) || ( which === 27 && !event.altKey ) ) {
@@ -189,7 +185,7 @@ var selector = "input[list]",
* @param {DOM element} link Link element that is the target of the event
*/
keyboardHandlerAutolist = function( which, link ) {
var _autolist = link.parentNode.parentNode,
var _autolist = link.parentNode.parentNode,
input = _autolist.previousSibling,
$input = $( input ),
_span, dest, value, len, children;
@@ -204,10 +200,9 @@ var selector = "input[list]",
showOptions( input, input.value );

return false;
}

// Backspace
else if ( which === 8 ) {
} else if ( which === 8 ) {
value = input.value;
len = value.length;

@@ -219,10 +214,9 @@ var selector = "input[list]",
$input.trigger( "setfocus.wb" );

return false;
}

// Enter key
else if ( which === 13) {
} else if ( which === 13) {
_span = link.getElementsByTagName( "span" );

// .al-val
@@ -239,18 +233,16 @@ var selector = "input[list]",
closeOptions( input );

return false;
}

// Tab or Escape key
else if ( which === 9 || which === 27 ) {
} else if ( which === 9 || which === 27 ) {
$input.trigger( "setfocus.wb" );
closeOptions( input );

return false;
}

// Up or down arrow
else if ( which === 38 || which === 40 ) {
} else if ( which === 38 || which === 40 ) {

// Up arrow
if ( which === 38 ) {
@@ -259,10 +251,9 @@ var selector = "input[list]",
children = _autolist.getElementsByTagName( "li" );
dest = children[ children.length - 1 ];
}
}

// Down arrow
else {
} else {
dest = link.parentNode.nextSibling;
if ( !dest ) {
dest = _autolist.getElementsByTagName( "li" )[ 0 ];

0 comments on commit 6b0b29c

Please sign in to comment.
You can’t perform that action at this time.