var widget = this;
// Config initialization
- config = $.extend( { maxLength: 255 }, config );
+ config = $.extend( {
+ maxLength: 255,
+ limit: 10
+ }, config );
// Parent constructor
mw.widgets.TitleInputWidget.parent.call( this, $.extend( {}, config, { autocomplete: false } ) );
OO.ui.mixin.LookupElement.call( this, config );
// Properties
- this.limit = config.limit || 10;
+ this.limit = config.limit;
this.maxLength = config.maxLength;
this.namespace = config.namespace !== undefined ? config.namespace : null;
this.relative = config.relative !== undefined ? config.relative : true;
/* Methods */
+ /**
+ * Get the namespace to prepend to titles in suggestions, if any.
+ *
+ * @return {number|null} Namespace number
+ */
+ mw.widgets.TitleInputWidget.prototype.getNamespace = function () {
+ return this.namespace;
+ };
+
+ /**
+ * Set the namespace to prepend to titles in suggestions, if any.
+ *
+ * @param {number|null} namespace Namespace number
+ */
+ mw.widgets.TitleInputWidget.prototype.setNamespace = function ( namespace ) {
+ this.namespace = namespace;
+ this.lookupCache = {};
+ this.closeLookupMenu();
+ };
+
/**
* @inheritdoc
*/