From: Krinkle Date: Sun, 3 Jul 2011 23:24:51 +0000 (+0000) Subject: Fix for the broken tests introduced in r91387. X-Git-Tag: 1.31.0-rc.0~29091 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/supprimer.php?a=commitdiff_plain;h=1d08327f4c87574df096d3f55c5fb60381c1664a;p=lhc%2Fweb%2Fwiklou.git Fix for the broken tests introduced in r91387. Check input before assuming there are no arguments and the values object is expected. --- diff --git a/resources/mediawiki/mediawiki.js b/resources/mediawiki/mediawiki.js index 63e9e291c2..28a57a285f 100644 --- a/resources/mediawiki/mediawiki.js +++ b/resources/mediawiki/mediawiki.js @@ -40,7 +40,7 @@ window.mediaWiki = new ( function( $ ) { * If selection was an array, returns an object of key/values (value is null if not found), * If selection was not passed or invalid, will return the 'values' object member (be careful as * objects are always passed by reference in JavaScript!). - * @return Map + * @return Values as a string or object, null if invalid/inexistant. */ Map.prototype.get = function( selection, fallback ) { if ( $.isArray( selection ) ) { @@ -59,7 +59,11 @@ window.mediaWiki = new ( function( $ ) { } return this.values[selection]; } - return this.values; + if ( selection === undefined ) { + return this.values; + } else { + return null; // invalid selection key + } }; /**