From: Brad Jorsch Date: Tue, 2 May 2017 16:35:27 +0000 (-0400) Subject: mw.special.apisandbox: Don't pass $label to OO.ui.FieldLayout X-Git-Tag: 1.31.0-rc.0~3339^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=e1946cc212febd0fe546f5d6c8307f79a4ad0a9f;p=lhc%2Fweb%2Fwiklou.git mw.special.apisandbox: Don't pass $label to OO.ui.FieldLayout They removed that functionality. Instead, access the FieldLayout's $label property to attach the click event handler we need. It's not documented (I think), but seems stable. Bug: T164149 Change-Id: I30e7ad51dc1a484203138919c19a55f77552f330 --- diff --git a/resources/src/mediawiki.special/mediawiki.special.apisandbox.js b/resources/src/mediawiki.special/mediawiki.special.apisandbox.js index 7cb67b0084..3cfce3f695 100644 --- a/resources/src/mediawiki.special/mediawiki.special.apisandbox.js +++ b/resources/src/mediawiki.special/mediawiki.special.apisandbox.js @@ -1357,7 +1357,7 @@ Util.fetchModuleInfo( this.apiModule ) .done( function ( pi ) { - var prefix, i, j, descriptionContainer, widget, $widgetLabel, widgetField, helpField, tmp, flag, count, + var prefix, i, j, descriptionContainer, widget, widgetField, helpField, tmp, flag, count, items = [], deprecatedItems = [], buttons = [], @@ -1573,20 +1573,18 @@ } ); - $widgetLabel = $( '' ); widgetField = new OO.ui.FieldLayout( widget, { align: 'left', classes: [ 'mw-apisandbox-widget-field' ], - label: prefix + pi.parameters[ i ].name, - $label: $widgetLabel + label: prefix + pi.parameters[ i ].name } ); - // FieldLayout only does click for InputElement - // widgets. So supply our own click handler. - $widgetLabel.on( 'click', widgetLabelOnClick.bind( widgetField ) ); + // We need our own click handler on the widget label to + // turn off the disablement. + widgetField.$label.on( 'click', widgetLabelOnClick.bind( widgetField ) ); // Don't grey out the label when the field is disabled, // it makes it too hard to read and our "disabled"