Prtksxna has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/376183 )
Change subject: [DEPRECATING CHANGE] SelectWidget: Rename getRelativeSelectableItem to findRelativeSelectableItem ...................................................................... [DEPRECATING CHANGE] SelectWidget: Rename getRelativeSelectableItem to findRelativeSelectableItem Bug: T76630 Change-Id: I7b556fcae7ac4c4a6508d931d7a5d9ee1e7c59e5 --- M src/widgets/SelectWidget.js 1 file changed, 21 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/83/376183/1 diff --git a/src/widgets/SelectWidget.js b/src/widgets/SelectWidget.js index fc5040a..e4887f7 100644 --- a/src/widgets/SelectWidget.js +++ b/src/widgets/SelectWidget.js @@ -757,7 +757,7 @@ }; /** - * Get an option by its position relative to the specified item (or to the start of the option array, + * Find an option by its position relative to the specified item (or to the start of the option array, * if item is `null`). The direction in which to search through the option array is specified with a * number: -1 for reverse (the default) or 1 for forward. The method will return an option, or * `null` if there are no options in the array. @@ -768,7 +768,7 @@ * true. Function takes an OO.ui.OptionWidget and returns a boolean. * @return {OO.ui.OptionWidget|null} Item at position, `null` if there are no items in the select */ -OO.ui.SelectWidget.prototype.getRelativeSelectableItem = function ( item, direction, filter ) { +OO.ui.SelectWidget.prototype.findRelativeSelectableItem = function ( item, direction, filter ) { var currentIndex, nextIndex, i, increase = direction > 0 ? 1 : -1, len = this.items.length; @@ -796,13 +796,31 @@ }; /** + * Get an option by its position relative to the specified item (or to the start of the option array, + * if item is `null`). The direction in which to search through the option array is specified with a + * number: -1 for reverse (the default) or 1 for forward. The method will return an option, or + * `null` if there are no options in the array. + * + * @deprecated 0.24.0 Use {@link #findRelativeSelectableItem} instead + * @param {OO.ui.OptionWidget|null} item Item to describe the start position, or `null` to start at the beginning of the array. + * @param {number} direction Direction to move in: -1 to move backward, 1 to move forward + * @param {Function} [filter] Only consider items for which this function returns + * true. Function takes an OO.ui.OptionWidget and returns a boolean. + * @return {OO.ui.OptionWidget|null} Item at position, `null` if there are no items in the select + */ +OO.ui.SelectWidget.prototype.getRelativeSelectableItem = function ( item, direction, filter ) { + OO.ui.warnDeprecation( 'SelectWidget#getRelativeSelectableItem: Deprecated function. Use findRelativeSelectableItem instead. See T76630.' ); + return this.findRelativeSelectableItem( item, direction, filter ); +}; + +/** * Get the next selectable item or `null` if there are no selectable items. * Disabled options and menu-section markers and breaks are not selectable. * * @return {OO.ui.OptionWidget|null} Item, `null` if there aren't any selectable items */ OO.ui.SelectWidget.prototype.getFirstSelectableItem = function () { - return this.getRelativeSelectableItem( null, 1 ); + return this.findRelativeSelectableItem( null, 1 ); }; /** -- To view, visit https://gerrit.wikimedia.org/r/376183 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7b556fcae7ac4c4a6508d931d7a5d9ee1e7c59e5 Gerrit-PatchSet: 1 Gerrit-Project: oojs/ui Gerrit-Branch: master Gerrit-Owner: Prtksxna <psax...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits