From: Bartosz DziewoƄski Date: Thu, 25 Aug 2016 04:34:35 +0000 (+0200) Subject: mw.htmlform: Don't refer to OO.ui if it might not be loaded X-Git-Tag: 1.31.0-rc.0~5892^2 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=b7379fcb5c54b2c0f91d33698f41ece9fce65b3f;p=lhc%2Fweb%2Fwiklou.git mw.htmlform: Don't refer to OO.ui if it might not be loaded Dependencies are loaded dynamically here, before this code runs. If there are no OOjs UI HTMLForm fields on the page, then OOjs UI is not loaded, and the attempt to check if we're working with a OO.ui.Widget would cause an exception. Invert the test to check for jQuery, which is always loaded. Follow-up to 89107070d14187915e760f8543579ec4d784620f. Bug: T143850 Change-Id: Ibaa5a15fe367ed7470e3e8176e52b13442aeb985 --- diff --git a/resources/src/mediawiki/htmlform/hide-if.js b/resources/src/mediawiki/htmlform/hide-if.js index cb717afad5..0fbbcbe5d3 100644 --- a/resources/src/mediawiki/htmlform/hide-if.js +++ b/resources/src/mediawiki/htmlform/hide-if.js @@ -156,7 +156,8 @@ } v = spec[ 2 ]; - if ( field instanceof OO.ui.Widget ) { + if ( !( field instanceof jQuery ) ) { + // field is a OO.ui.Widget if ( field.supports( 'isSelected' ) ) { getVal = function () { var selected = field.isSelected();