r45304 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45303‎ | r45304 | r45305 >
Date:00:11, 2 January 2009
Author:simetrical
Status:ok
Tags:
Comment:
Don't use for (i in array) in JavaScript

This reportedly can cause errors, because it will return all object
attributes, not just array elements. Use a C-style for here instead.
This could be done in other places too -- the immediate motive here is
that this might be related:

http://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)#Sortable_tables_.26_Firefox_3.0.5

The functionality seems to still work.
Modified paths:
  • /trunk/phase3/skins/common/wikibits.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/wikibits.js
@@ -661,7 +661,7 @@
662662 span.setAttribute('sortdir','down');
663663 }
664664
665 - for(var i in staticRows) {
 665+ for (var i = 0; i < staticRows.length; i++) {
666666 var row = staticRows[i];
667667 newRows.splice(row[2], 0, row);
668668 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r45307Increment $wgStyleVersion for r45304.tstarling05:29, 2 January 2009

Status & tagging log