From: Krinkle Date: Fri, 23 Dec 2011 17:03:25 +0000 (+0000) Subject: [Core JS] scan all /phase3/, change certain constructors to literals X-Git-Tag: 1.31.0-rc.0~25789 X-Git-Url: http://git.cyclocoop.org/%22%20.%20%20%20%24self2%20.%20%20%20%22&var_mode_affiche=boucle?a=commitdiff_plain;h=06b838bced8cdee7f58325616f3440e6dd2b384d;p=lhc%2Fweb%2Fwiklou.git [Core JS] scan all /phase3/, change certain constructors to literals * new String, new Boolean, new Number -- should not be used since they don't compare very well: ; 5 !== new Number( 5 ) // true ; !!new Boolean( false ) // true, objects are truethy -- If type conversion is intended, they should be used as functions instead of constructors. * new Array, new Object -- literals are shorter, no point in not using them. --- diff --git a/skins/common/mwsuggest.js b/skins/common/mwsuggest.js index 6dbce050cb..a0f30f32b3 100644 --- a/skins/common/mwsuggest.js +++ b/skins/common/mwsuggest.js @@ -30,8 +30,8 @@ window.os_mouse_moved = false; // delay between keypress and suggestion (in ms) window.os_search_timeout = 250; // these pairs of inputs/forms will be autoloaded at startup -window.os_autoload_inputs = new Array('searchInput', 'searchInput2', 'powerSearchText', 'searchText'); -window.os_autoload_forms = new Array('searchform', 'searchform2', 'powersearch', 'search' ); +window.os_autoload_inputs = ['searchInput', 'searchInput2', 'powerSearchText', 'searchText']; +window.os_autoload_forms = ['searchform', 'searchform2', 'powersearch', 'search']; // if we stopped the service window.os_is_stopped = false; // max lines to show in suggest table @@ -423,7 +423,7 @@ window.os_setupDatalist = function( r, results ) { } s.setAttribute( 'list', r.container ); - r.results = new Array(); + r.results = []; r.resultCount = results.length; r.visible = true; for ( i = 0; i < results.length; i++ ) { @@ -643,7 +643,7 @@ window.os_createResultTable = function( r, results ) { var c = document.getElementById( r.container ); var width = c.offsetWidth - os_operaWidthFix( c.offsetWidth ); var html = ''; - r.results = new Array(); + r.results = []; r.resultCount = results.length; for( i = 0; i < results.length; i++ ) { var title = os_decodeValue( results[i] );