returnValue = (key in obj) ? undefined : obj[key];
By standard, this cannot return anything other undefined.
This code has been broken since the introduction of the module
in 2012 (
32377424b, r72349).
The functionality also didn't have test (naturally), and isn't
used anywhere in Wikimedia Git. Simply remove it.
Also remove the confusing $() wrapping of the non-getter return
value that provides chainability.
The 'this' inside a jQuery method is already an instance of jQuery,
pulling it through $() again achieves very little.
Change-Id: Id13861d42b65a759d74670d8c5850aecee4daf7d
* $( '#textbox' ).suggestions( { option1: value1, option2: value2 } );
* $( '#textbox' ).suggestions( option, value );
*
* $( '#textbox' ).suggestions( { option1: value1, option2: value2 } );
* $( '#textbox' ).suggestions( option, value );
*
- * Get option:
- *
- * value = $( '#textbox' ).suggestions( option );
- *
* Initialize:
*
* $( '#textbox' ).suggestions();
* Initialize:
*
* $( '#textbox' ).suggestions();
// See file header for method documentation
$.fn.suggestions = function () {
// See file header for method documentation
$.fn.suggestions = function () {
- var returnValue,
- args = arguments;
$( this ).each( function () {
var context, key;
$( this ).each( function () {
var context, key;
if ( args.length > 1 ) {
// Set property values
$.suggestions.configure( context, args[ 0 ], args[ 1 ] );
if ( args.length > 1 ) {
// Set property values
$.suggestions.configure( context, args[ 0 ], args[ 1 ] );
- } else if ( returnValue === null || returnValue === undefined ) {
- // Get property values, but don't give access to internal data - returns only the first
- returnValue = ( args[ 0 ] in context.config ? undefined : context.config[ args[ 0 ] ] );
// Store the context for next time
$( this ).data( 'suggestions-context', context );
} );
// Store the context for next time
$( this ).data( 'suggestions-context', context );
} );
- return returnValue !== undefined ? returnValue : $( this );