r74924 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74923‎ | r74924 | r74925 >
Date:22:03, 17 October 2010
Author:hartman
Status:ok
Tags:
Comment:
Use for loops instead of object iterators on arrays.
Modified paths:
  • /branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js
@@ -94,7 +94,7 @@
9595 var pound = '';
9696 // loop over the data and group by title
9797 if ( data.query && data.query.recentchanges ) {
98 - for ( var i in data.query.recentchanges ) {
 98+ for ( var i=0; i < data.query.recentchanges.length; i++ ) {
9999 var rc = data.query.recentchanges[i];
100100 if ( !titleSet[ rc.title ] ) {
101101 titleSet[ rc.title ] = true;
@@ -231,7 +231,7 @@
232232 }
233233 };
234234
235 - for( var i in page.imageinfo[0].metadata ){
 235+ for( var i=0; i < page.imageinfo[0].metadata.length; i++ ){
236236 if( page.imageinfo[0].metadata[i].name == 'length' ){
237237 resource.duration = page.imageinfo[0].metadata[i].value;
238238 }
@@ -421,4 +421,4 @@
422422 '|Description =' + resource.inlineDesc + "\n" +
423423 '}}';
424424 }
425 -}
\ No newline at end of file
 425+}

Status & tagging log