Last modified: 2007-02-03 21:59:07 UTC
In wikibits.js on line 367 or so, there are two for loops that use the for..in mechanism to loop through arrays. Since these are arrays and not objects they should be looped through using plain for loops. Using for..in causes problems when you include javascript libraries like older versions of prototype that mess with Object.prototype. To see the fun bugs it causes, try including prototype in your skin and look at the edit toolbar. To fix this, change: for(i in mwEditButtons) { to: for (var i = 0; i < mwEditButtons.length; i++) { and: for(i in mwCustomEditButtons) { to: for (var i = 0; i < mwCustomEditButtons.length; i++) { For further information about properly iterating arrays in javascript see: http://simon.incutio.com/slides/2006/etech/javascript/js-reintroduction-notes.html#arrays
Just wanted to say that I had to do the same, with the latest version of prototype. By the way, this isn't because prototype messes with Object, but because it messes with Array. (For example, the for...in loop on line 470 works fine because ta is an Object, not an Array.)
Created attachment 2222 [details] Patch for wikibits.js fixing protoype incompatibility Not sure how things work around here...is a diff easier to commit than scrolling to line 369?
Attached patches should generally be in unified diff format. If a dev would prefer to just manually scroll to the right lines, they can do that too.
> Attached patches should generally be in unified diff format. Was my attachment in the right format?
Yes.
Thanks for the patch Dan. Applied in r19744.