Last modified: 2012-11-02 19:14:14 UTC
In the MwEmbedSupport extension, MwEmbedModules/MwEmbedSupport/jquery/jquery.mwEmbedUtil.js contains the following buggy code: /** * Extend Unique to work with strings and number values * http://paulirish.com/2010/duck-punching-with-jquery/ */ var _oldUnique = $.unique; $.unique = function(arr){ // Do the default behavior only if we got an array of elements if (!!arr[0].nodeType){ return _oldUnique.apply(this,arguments); } else { // reduce the array to contain no dupes via grep/inArray return $.grep(arr,function(v,k){ return $.inArray(v,arr) === k; }); } }; !!arr[0].nodeType causes an exception for empty arrays. This broke one of the Wikipedia user scripts I developed, which uses jquery.ui.tabs. The proper fix is to put the array-specific code in a separate function rather than trying to monkey patch a function "chiefly used internally by jQuery". I'm just hesitant to do that myself because of how the TimedMediaHandler code is spread across two Git repositories.
Thanks for the bug report, PleaseStand! Go ahead and make the fix - just say in the commit message for each of the two commits, "DO NOT MERGE until and unless you're merging with the other half of the fix in (other repository)". Does that make sense? Thanks!
patches for MwEmbedSupport and TimedMediaHandler are in the review queue at: https://gerrit.wikimedia.org/r/#/c/31386/ https://gerrit.wikimedia.org/r/#/c/31387/
The patches have been merged; closing this bug.