r94335 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94334‎ | r94335 | r94336 >
Date:10:25, 12 August 2011
Author:dantman
Status:ok
Tags:
Comment:
Use [] instead of new Array.
Modified paths:
  • /trunk/phase3/skins/common/protect.js (modified) (history)
  • /trunk/phase3/skins/common/wikibits.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/protect.js
@@ -252,7 +252,7 @@
253253 */
254254 'getLevelSelectors': function() {
255255 var all = document.getElementsByTagName("select");
256 - var ours = new Array();
 256+ var ours = [];
257257 for (var i = 0; i < all.length; i++) {
258258 var element = all[i];
259259 if (element.id.match(/^mwProtect-level-/)) {
@@ -281,7 +281,7 @@
282282 */
283283 'getExpiryInputs': function() {
284284 var all = document.getElementsByTagName("input");
285 - var ours = new Array();
 285+ var ours = [];
286286 for (var i = 0; i < all.length; i++) {
287287 var element = all[i];
288288 if (element.name.match(/^mwProtect-expiry-/)) {
@@ -309,7 +309,7 @@
310310 */
311311 'getExpirySelectors': function() {
312312 var all = document.getElementsByTagName("select");
313 - var ours = new Array();
 313+ var ours = [];
314314 for (var i = 0; i < all.length; i++) {
315315 var element = all[i];
316316 if (element.id.match(/^mwProtectExpirySelection-/)) {
Index: trunk/phase3/skins/common/wikibits.js
@@ -319,7 +319,7 @@
320320 link.setAttribute( 'title', tooltip );
321321 }
322322 if ( accesskey && tooltip ) {
323 - updateTooltipAccessKeys( new Array( link ) );
 323+ updateTooltipAccessKeys( [link] );
324324 }
325325
326326 if ( nextnode && nextnode.parentNode == node ) {
@@ -445,7 +445,7 @@
446446 From http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/
447447 */
448448 window.getElementsByClassName = function( oElm, strTagName, oClassNames ) {
449 - var arrReturnElements = new Array();
 449+ var arrReturnElements = [];
450450 if ( typeof( oElm.getElementsByClassName ) == 'function' ) {
451451 /* Use a native implementation where possible FF3, Saf3.2, Opera 9.5 */
452452 var arrNativeReturn = oElm.getElementsByClassName( oClassNames );
@@ -460,7 +460,7 @@
461461 return arrReturnElements;
462462 }
463463 var arrElements = ( strTagName == '*' && oElm.all ) ? oElm.all : oElm.getElementsByTagName( strTagName );
464 - var arrRegExpClassNames = new Array();
 464+ var arrRegExpClassNames = [];
465465 if( typeof oClassNames == 'object' ) {
466466 for( var i = 0; i < oClassNames.length; i++ ) {
467467 arrRegExpClassNames[arrRegExpClassNames.length] =
@@ -667,4 +667,4 @@
668668
669669 if ( ie6_bugs ) {
670670 importScriptURI( stylepath + '/common/IEFixes.js' );
671 -}
\ No newline at end of file
 671+}

Status & tagging log