It's possible, that the "catlinks" $nodes variable is re-assigned, before
mw.loader.using finished loading the mediawiki.widgets modules (which will
trigger the execution of the passed function). The function inside the
mw.loader.using call uses the $nodes variable and expects a set of infusable
OOUI elements, but (depending on the loading time of the modules) it's already
re-assigned with the .catlinks element.
Fix this by renaming the variable $nodes to $oouiNodes to break this race
condition. It's possible to rename the variable used for catlinks, but $nodes is
used in other places of the code, too, so I think this is the nicer solution.
Bug: T123074
Change-Id: Ie18b576a16c33645ab04e2957b23169bc2e17202
// Things outside the wikipage content
$( function () {
- var $nodes;
+ var $nodes, $oouiNodes;
if ( !supportsPlaceholder ) {
// Exclude content to avoid hitting it twice for the (first) wikipage content
$nodes.updateTooltipAccessKeys();
// Infuse OOUI widgets, if any are present
- $nodes = $( '[data-ooui]' );
- if ( $nodes.length ) {
+ $oouiNodes = $( '[data-ooui]' );
+ if ( $oouiNodes.length ) {
// FIXME: We should only load the widgets that are being infused
mw.loader.using( [ 'mediawiki.widgets', 'mediawiki.widgets.UserInputWidget' ] ).done( function () {
- $nodes.each( function () {
+ $oouiNodes.each( function () {
OO.ui.infuse( this );
} );
} );