Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/185110

Change subject: Revert "[BREAKING CHANGE] LookupInputWidget: Remove the silly 
'input' parameter"
......................................................................

Revert "[BREAKING CHANGE] LookupInputWidget: Remove the silly 'input' parameter"

Per T86851, we'll do this differently.

This reverts commit e578d3e71987d4f9b4d09803544e43e587b4b99f.

Change-Id: Ia8353605997fce59f26d1c30297a49a8c3f2eb5e
---
M src/widgets/LookupInputWidget.js
1 file changed, 11 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/10/185110/1

diff --git a/src/widgets/LookupInputWidget.js b/src/widgets/LookupInputWidget.js
index 7ec71ee..b2d586c 100644
--- a/src/widgets/LookupInputWidget.js
+++ b/src/widgets/LookupInputWidget.js
@@ -1,5 +1,5 @@
 /**
- * Mixin that adds a menu showing suggested values for a OO.ui.TextInputWidget.
+ * Mixin that adds a menu showing suggested values for a text input.
  *
  * Subclasses must handle `select` and `choose` events on #lookupMenu to make 
use of selections.
  *
@@ -11,18 +11,21 @@
  * @abstract
  *
  * @constructor
+ * @param {OO.ui.TextInputWidget} input Input widget
  * @param {Object} [config] Configuration options
  * @cfg {jQuery} [$overlay] Overlay for dropdown; defaults to relative 
positioning
- * @cfg {jQuery} [$container=this.$element] Element to render menu under
+ * @cfg {jQuery} [$container=input.$element] Element to render menu under
  */
-OO.ui.LookupInputWidget = function OoUiLookupInputWidget( config ) {
+OO.ui.LookupInputWidget = function OoUiLookupInputWidget( input, config ) {
        // Configuration initialization
        config = config || {};
 
        // Properties
+       this.lookupInput = input;
        this.$overlay = config.$overlay || this.$element;
        this.lookupMenu = new OO.ui.TextInputMenuSelectWidget( this, {
                $: OO.ui.Element.static.getJQuery( this.$overlay ),
+               input: this.lookupInput,
                $container: config.$container
        } );
        this.lookupCache = {};
@@ -32,12 +35,12 @@
        this.lookupInputFocused = false;
 
        // Events
-       this.$input.on( {
+       this.lookupInput.$input.on( {
                focus: this.onLookupInputFocus.bind( this ),
                blur: this.onLookupInputBlur.bind( this ),
                mousedown: this.onLookupInputMouseDown.bind( this )
        } );
-       this.connect( this, { change: 'onLookupInputChange' } );
+       this.lookupInput.connect( this, { change: 'onLookupInputChange' } );
        this.lookupMenu.connect( this, { toggle: 'onLookupMenuToggle' } );
 
        // Initialization
@@ -162,7 +165,7 @@
  */
 OO.ui.LookupInputWidget.prototype.populateLookupMenu = function () {
        var widget = this,
-               value = this.getValue();
+               value = this.lookupInput.getValue();
 
        if ( this.lookupsDisabled ) {
                return;
@@ -214,7 +217,7 @@
  */
 OO.ui.LookupInputWidget.prototype.getLookupMenuItems = function () {
        var widget = this,
-               value = this.getValue(),
+               value = this.lookupInput.getValue(),
                deferred = $.Deferred(),
                ourRequest;
 
@@ -222,7 +225,7 @@
        if ( Object.prototype.hasOwnProperty.call( this.lookupCache, value ) ) {
                deferred.resolve( this.getLookupMenuItemsFromData( 
this.lookupCache[value] ) );
        } else {
-               this.pushPending();
+               this.lookupInput.pushPending();
                this.lookupQuery = value;
                ourRequest = this.lookupRequest = this.getLookupRequest();
                ourRequest

-- 
To view, visit https://gerrit.wikimedia.org/r/185110
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia8353605997fce59f26d1c30297a49a8c3f2eb5e
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to