See URL.
Version: unspecified
Severity: enhancement
URL: http://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)#mwEmbed_.2B_Twinkle_.3D_video_not_loading
See URL.
Version: unspecified
Severity: enhancement
URL: http://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)#mwEmbed_.2B_Twinkle_.3D_video_not_loading
Nx.devnull wrote:
The problem is this:
var moduleRequestSet = [];
...
for(var moduleName in moduleRequestSet) { ... }
This works fine as long as no-one touches Array.prototype, but Twinkle adds three new functions, which results in mwEmbed trying to load a nonexistent module called "uniq".
The solution in this case should be as simple as changing the declaration to var moduleRequestSet = {};, but that still doesn't protect against someone messing with Object.prototype, and it won't allow you to use the Array type's functions, e.g. push.
It might be a better idea to use something like Prototype's Hash.
mdale wrote:
Scripts should not extend base object prototypes! .. But to the extent this can be worked around I use for( i = 0; array.length; i++ ) for arrays. If a script extends the base "Object" prototype that will be complicated to work around and slow everything down since every for loop in the entire codebase would have to check the property types instance variables and or use function heavy jQuery.each(object, function(inx, item){ /*..*/ }); iterator, which is a lot of overhead for some of loops that need to be fast.
fixed in r69064