jenkins-bot has submitted this change and it was merged.

Change subject: InputWidget: Clarify documentation of #getInputElement
......................................................................


InputWidget: Clarify documentation of #getInputElement

* Explain why we document a `config` parameter, but don't use it.
* Use @inheritdoc in subclasses.
* Mark `config` as non-optional (because it isn't) and simplify code
  in subclasses that checked for it.

Bug: T87649
Change-Id: I2357072aa8692111a34824ea149383100b14ab34
---
M src/widgets/ButtonInputWidget.js
M src/widgets/CheckboxInputWidget.js
M src/widgets/DropdownInputWidget.js
M src/widgets/InputWidget.js
M src/widgets/RadioInputWidget.js
M src/widgets/TextInputWidget.js
6 files changed, 9 insertions(+), 23 deletions(-)

Approvals:
  Trevor Parscal: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/widgets/ButtonInputWidget.js b/src/widgets/ButtonInputWidget.js
index 52f60f3..a9243a3 100644
--- a/src/widgets/ButtonInputWidget.js
+++ b/src/widgets/ButtonInputWidget.js
@@ -68,18 +68,11 @@
 /* Methods */
 
 /**
- * Get input element.
- *
+ * @inheritdoc
  * @private
- * @param {Object} [config] Configuration options
- * @return {jQuery} Input element
  */
 OO.ui.ButtonInputWidget.prototype.getInputElement = function ( config ) {
-       // Configuration initialization
-       config = config || {};
-
        var html = '<' + ( config.useInputTag ? 'input' : 'button' ) + ' 
type="' + config.type + '">';
-
        return this.$( html );
 };
 
diff --git a/src/widgets/CheckboxInputWidget.js 
b/src/widgets/CheckboxInputWidget.js
index 82283e9..d04d1c3 100644
--- a/src/widgets/CheckboxInputWidget.js
+++ b/src/widgets/CheckboxInputWidget.js
@@ -24,10 +24,8 @@
 /* Methods */
 
 /**
- * Get input element.
- *
+ * @inheritdoc
  * @private
- * @return {jQuery} Input element
  */
 OO.ui.CheckboxInputWidget.prototype.getInputElement = function () {
        return this.$( '<input type="checkbox" />' );
diff --git a/src/widgets/DropdownInputWidget.js 
b/src/widgets/DropdownInputWidget.js
index 938408c..424ee4b 100644
--- a/src/widgets/DropdownInputWidget.js
+++ b/src/widgets/DropdownInputWidget.js
@@ -39,6 +39,7 @@
 
 /**
  * @inheritdoc
+ * @private
  */
 OO.ui.DropdownInputWidget.prototype.getInputElement = function () {
        return this.$( '<input type="hidden">' );
diff --git a/src/widgets/InputWidget.js b/src/widgets/InputWidget.js
index 02fac7a..8801a2c 100644
--- a/src/widgets/InputWidget.js
+++ b/src/widgets/InputWidget.js
@@ -55,8 +55,11 @@
 /**
  * Get input element.
  *
+ * Subclasses of OO.ui.InputWidget use the `config` parameter to produce 
different elements in
+ * different circumstances. The element must have a `value` property (like 
form elements).
+ *
  * @private
- * @param {Object} [config] Configuration options
+ * @param {Object} config Configuration options
  * @return {jQuery} Input element
  */
 OO.ui.InputWidget.prototype.getInputElement = function () {
diff --git a/src/widgets/RadioInputWidget.js b/src/widgets/RadioInputWidget.js
index 8da733d..8ce2dc0 100644
--- a/src/widgets/RadioInputWidget.js
+++ b/src/widgets/RadioInputWidget.js
@@ -27,10 +27,8 @@
 /* Methods */
 
 /**
- * Get input element.
- *
+ * @inheritdoc
  * @private
- * @return {jQuery} Input element
  */
 OO.ui.RadioInputWidget.prototype.getInputElement = function () {
        return this.$( '<input type="radio" />' );
diff --git a/src/widgets/TextInputWidget.js b/src/widgets/TextInputWidget.js
index 116a354..348ff3c 100644
--- a/src/widgets/TextInputWidget.js
+++ b/src/widgets/TextInputWidget.js
@@ -262,18 +262,11 @@
 };
 
 /**
- * Get input element.
- *
+ * @inheritdoc
  * @private
- * @param {Object} [config] Configuration options
- * @return {jQuery} Input element
  */
 OO.ui.TextInputWidget.prototype.getInputElement = function ( config ) {
-       // Configuration initialization
-       config = config || {};
-
        var type = config.type || 'text';
-
        return config.multiline ? this.$( '<textarea>' ) : this.$( '<input 
type="' + type + '" />' );
 };
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2357072aa8692111a34824ea149383100b14ab34
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to