* $( '#textbox' ).suggestions( { option1: value1, option2: value2 } );
* $( '#textbox' ).suggestions( option, value );
*
- * Get option:
- *
- * value = $( '#textbox' ).suggestions( option );
- *
* Initialize:
*
* $( '#textbox' ).suggestions();
* input or not.
*/
-( function ( $, mw ) {
+( function () {
var hasOwn = Object.hasOwnProperty;
if ( context.data.timerID !== null ) {
clearTimeout( context.data.timerID );
}
- if ( $.isFunction( context.config.cancel ) ) {
+ if ( typeof context.config.cancel === 'function' ) {
context.config.cancel.call( context.data.$textbox );
}
},
// See file header for method documentation
$.fn.suggestions = function () {
-
// Multi-context fields
- var returnValue,
- args = arguments;
+ var args = arguments;
$( this ).each( function () {
var context, key;
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 );
} );
- return returnValue !== undefined ? returnValue : $( this );
+ return this;
};
/**
* @mixins jQuery.plugin.suggestions
*/
-}( jQuery, mediaWiki ) );
+}() );