MediaWiki talk:Wikimediaplayer.js

Fix for link iteration
editprotected Hi there. An issue was identified at Village Pump (technical) that I believe is caused by a combination of bad behavior in Internet Explorer and this module. In short, the use of a for/in loop with  objects returned from   has incorrect behavior if there are any named anchors in the page whose   attribute starts with a number (as is the case when section names start with a number). If this is the case, any attempt to use bracket syntax to select the node from the collection will interpret the first part of the  attribute as a number and fail if that numeric index does not exist.

One fix is to use a traditional for loop to fix this. The requested changes is to change the two instances of this code (lines 95 and 125):

for( var key in links )

To be this code:

for( var key = 0; key < links.length; key++ )

This will cause all browsers to use only numeric indexes that are in range and fix problems people are seeing in Internet Explorer. The problems with this script seem to be preventing all user JavaScript from loading on affected pages. Mike Dillon 15:49, 23 May 2007 (UTC)
 * [[Image:Yes check.svg|20px]] Done. Cheers. --MZMcBride 19:25, 23 May 2007 (UTC)
 * Thanks. The users reporting the problem have confirmed that this change fixed it. Mike Dillon 03:03, 27 May 2007 (UTC)