提交 95101bf3 编写于 作者: B Benjamin Pasero

Revert "SelectBox: Add bounds checking on selected option. Addresses: #43475, #44309 (#47044)"

This reverts commit 043538ee.
上级 356c4bab
......@@ -229,17 +229,7 @@ export class SelectBoxList implements ISelectBoxDelegate, IDelegate<ISelectOptio
}
if (selected !== undefined) {
// Guard against out of bounds selected values
// Cannot currently return error, set selected within range
if (selected >= 0 && selected < this.options.length) {
this.select(selected);
} else if (selected > this.options.length - 1) {
// This could make client out of sync with the select
this.select(this.options.length - 1);
console.error('selectBoxCustom: setOptions selected exceeds options length');
} else if (selected < 0) {
this.selected = 0;
}
this.select(selected);
}
}
......@@ -363,12 +353,6 @@ export class SelectBoxList implements ISelectBoxDelegate, IDelegate<ISelectOptio
return;
}
// Bounds check selected/list before attempting to show
if (this.selected < 0 || this.selected > this.options.length - 1 || !this.selectList.length) {
console.error('selectBoxCustom: showSelectDropDown this.select exceeds options length or empty list');
return;
}
this._isVisible = true;
this.cloneElementFont(this.selectElement, this.selectDropDownContainer);
this.contextViewProvider.showContextView({
......
......@@ -84,17 +84,7 @@ export class SelectBoxNative implements ISelectBoxDelegate {
}
if (selected !== undefined) {
// Guard against out of bounds selected values
// Cannot currently return error, set selected within range
if (selected >= 0 && selected < this.options.length) {
this.select(selected);
} else if (selected > this.options.length - 1) {
// This could make client out of sync with the select
this.select(this.options.length - 1);
console.error('selectBoxNative: setOptions selected exceeds options length');
} else if (selected < 0) {
this.selected = 0;
}
this.select(selected);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册