Bug 622243 - SelectHelperUI code hang fennec if the <select/> contains too much data [r=mfinkle]

This commit is contained in:
Vivien Nicolas 2011-01-03 12:57:53 +01:00
parent 38cdb2c811
commit 284f77c0d7

View File

@ -2252,6 +2252,8 @@ var SelectHelperUI = {
this._selectedIndexes = this._getSelectedIndexes();
let firstSelected = null;
// Using a fragment prevent us to hang on huge list
let fragment = document.createDocumentFragment();
let choices = aList.choices;
for (let i = 0; i < choices.length; i++) {
let choice = choices[i];
@ -2260,7 +2262,7 @@ var SelectHelperUI = {
item.setAttribute("label", choice.text);
choice.disabled ? item.setAttribute("disabled", choice.disabled)
: item.removeAttribute("disabled");
this._container.appendChild(item);
fragment.appendChild(item);
if (choice.group) {
item.classList.add("optgroup");
@ -2278,6 +2280,7 @@ var SelectHelperUI = {
firstSelected = firstSelected || item;
}
}
this._container.appendChild(fragment);
this._panel.hidden = false;
this._panel.height = this._panel.getBoundingClientRect().height;