From b7379fcb5c54b2c0f91d33698f41ece9fce65b3f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Thu, 25 Aug 2016 06:34:35 +0200 Subject: [PATCH] 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 --- resources/src/mediawiki/htmlform/hide-if.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(); -- 2.20.1