Page MenuHomePhabricator

OO.ui.InputWidget.prototype.getInputElement has a config parameter in its documentation, but not in its implementation (because it's only used in subclasses)
Closed, ResolvedPublic

Description

I was trying to understand how OOjs-UI input widgets work, and found this code:

/**
 * Get input element.
 *
 * @private
 * @param {Object} [config] Configuration options
 * @return {jQuery} Input element
 */
OO.ui.InputWidget.prototype.getInputElement = function () {
	return this.$( '<input>' );
};

Is the config parameter needed here? I suspect that it is, but I might be wrong.

See also T87648.

Event Timeline

Amire80 raised the priority of this task from to Needs Triage.
Amire80 updated the task description. (Show Details)
Amire80 added a project: OOUI.
Amire80 subscribed.

We document parameters that can be passed but if they are not used by the method we don't include them in the arguments list.

Yes, this is expected. We do use the config parameter in two InputWidget subclasses: ButtonInputWidget and TextInputWidget. This looks a bit weird, but it's a limitation of JSDuck documentation system, and I don't think we can work around it without the docs in subclasses becoming messed up.

Thank you for the diligence!

gerritbot subscribed.

Change 187256 had a related patch set uploaded (by Bartosz Dziewoński):
InputWidget: Clarify documentation of #getInputElement

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

Patch-For-Review

matmarex renamed this task from OO.ui.InputWidget.prototype.getInputElement has a config parameter in its documentation, but not in its implementation to OO.ui.InputWidget.prototype.getInputElement has a config parameter in its documentation, but not in its implementation (because it's only used in subclasses).Jan 28 2015, 10:40 PM
matmarex set Security to None.
matmarex moved this task from Backlog to Next-up on the OOUI board.
matmarex moved this task from Next-up to Doing on the OOUI board.

Change 187256 merged by jenkins-bot:
InputWidget: Clarify documentation of #getInputElement

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