Misc jshint fixes

* Move the invocation into the parens that contain the function.
* unescaped regex
* Do not wrap function literals in parens unless they are to be
  immediately invoked.

Change-Id: Ib3360f88fb7674af0e857d8a84a91fdac1fd8487
This commit is contained in:
Santhosh Thottingal
2012-09-04 16:01:05 +05:30
parent 126af493b7
commit dd3d214cb5
7 changed files with 25 additions and 27 deletions

View File

@@ -84,7 +84,9 @@
this.languages = this.options.languages;
for ( var code in this.languages ) {
if ( $.uls.data.languages[code] === undefined ) {
window.console && console.log && console.log( "ULS: Unknown language " + code + "." );
if ( window.console && window.console.log ) {
window.console.log( "ULS: Unknown language " + code + "." );
}
delete this.languages[code];
}
}
@@ -257,11 +259,9 @@
if ( !this.shown ) {
return;
}
switch( e.keyCode ) {
case 27: // escape
this.hide();
e.preventDefault();
break;
if ( e.keyCode === 27 ) { // escape
this.hide();
e.preventDefault();
}
e.stopPropagation();
},
@@ -270,11 +270,9 @@
if ( !this.shown ) {
return;
}
switch( e.keyCode ) {
case 27: // escape
this.hide();
e.preventDefault();
break;
if ( e.keyCode === 27 ) { // escape
this.hide();
e.preventDefault();
}
e.stopPropagation();
},
@@ -317,4 +315,4 @@
$.fn.uls.Constructor = ULS;
} )( jQuery );
} ( jQuery ) );

File diff suppressed because one or more lines are too long

View File

@@ -347,4 +347,4 @@
$.uls.data.languagesInTerritory = function( territory ) {
return $.uls.data.territories[territory];
};
} )( jQuery );
} ( jQuery ) );

View File

@@ -37,13 +37,13 @@
this.listen();
};
var delay = function() {
var delay = ( function() {
var timer = 0;
return ( function( callback, milliseconds ) {
return function( callback, milliseconds ) {
clearTimeout( timer );
timer = setTimeout( callback, milliseconds );
} );
}();
};
} () );
LanguageFilter.prototype = {
@@ -230,7 +230,7 @@
},
escapeRegex: function( value ) {
return value.replace( /[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&" );
return value.replace( /[\-\[\]{}()*+?.,\\\^$\|#\s]/g, "\\$&" );
},
/**
@@ -294,4 +294,4 @@
}
}
} )( jQuery );
} ( jQuery ) );

View File

@@ -256,4 +256,4 @@
$.fn.lcd.Constructor = LanguageCategoryDisplay;
} )( jQuery );
} ( jQuery ) );

View File

@@ -171,12 +171,12 @@
$.fn.regionselector.Constructor = RegionSelector;
var delay = function () {
var delay = ( function () {
var timer = 0;
return ( function ( callback, milliseconds ) {
return function ( callback, milliseconds ) {
clearTimeout( timer );
timer = setTimeout( callback, milliseconds );
} );
}();
};
} () );
} )( jQuery );
} ( jQuery ) );