From 7ae768c9899f7fd681c34d2c3cff33d2e882b8e0 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Tue, 8 Jul 2014 15:15:49 -0400 Subject: [PATCH] mediawiki.htmlform: Fix broken $() call Follows-up c310e7b40c, daa92bb06e. The $( Array ) signature requires the list to contain DOM nodes, not jQuery objects. The fields variable should be a list of nodes, not jQuery collections. Also: * Improve @return documentation for hideIfParse(). * Flag hideIfParse() and hideIfGetField() as private to remove them from the jQuery#htmlform API documentation as methods that would be mixed into the jQuery prototype (they're not). Bug: 67685 Change-Id: I4bb93ad234cdd4a1f412b759065138e2831be2a6 --- resources/src/mediawiki/mediawiki.htmlform.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/resources/src/mediawiki/mediawiki.htmlform.js b/resources/src/mediawiki/mediawiki.htmlform.js index 8be1321ea4..9eea492e45 100644 --- a/resources/src/mediawiki/mediawiki.htmlform.js +++ b/resources/src/mediawiki/mediawiki.htmlform.js @@ -15,6 +15,7 @@ * ending in array keys matching the given name (e.g. "baz" matches * "foo[bar][baz]"). * + * @private * @param {jQuery} element * @param {string} name * @return {jQuery|null} @@ -42,9 +43,12 @@ * Helper function for hide-if to return a test function and list of * dependent fields for a hide-if specification. * + * @private * @param {jQuery} element * @param {Array} hide-if spec - * @return {Array} 2 elements: jQuery of dependent fields, and test function + * @return {Array} + * @return {jQuery} return.0 Dependent fields + * @return {Function} return.1 Test function */ function hideIfParse( $el, spec ) { var op, i, l, v, $field, $fields, fields, func, funcs, getVal; @@ -63,7 +67,7 @@ throw new Error( op + ' parameters must be arrays' ); } v = hideIfParse( $el, spec[i] ); - fields.push( v[0] ); + fields = fields.concat( v[0].toArray() ); funcs.push( v[1] ); } $fields = $( fields ); -- 2.20.1