The index of the option being deleted needs to be remembered before the it is removed from the list

This commit is contained in:
rods%netscape.com 1999-08-25 13:44:49 +00:00
Родитель 57d1c13737
Коммит 43bd3be0ff
2 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -676,6 +676,8 @@ nsHTMLSelectElement::RemoveOption(nsIContent* aContent)
// as we will manually update the widget at frame construction time.
if (!mOptions) return NS_OK;
PRInt32 oldIndex = mOptions->IndexOf(aContent);
// Remove the option from the options list
mOptions->RemoveOption(aContent);
@ -689,7 +691,7 @@ nsHTMLSelectElement::RemoveOption(nsIContent* aContent)
// We can't get our index if we've already been replaced in the OptionList.
// If we couldn't get our index, pass -1, remove all options and recreate
// Coincidentally, IndexOf returns -1 if the option isn't found in the list
result = selectFrame->RemoveOption(mOptions->IndexOf(aContent));
result = selectFrame->RemoveOption(oldIndex);
}
}

Просмотреть файл

@ -676,6 +676,8 @@ nsHTMLSelectElement::RemoveOption(nsIContent* aContent)
// as we will manually update the widget at frame construction time.
if (!mOptions) return NS_OK;
PRInt32 oldIndex = mOptions->IndexOf(aContent);
// Remove the option from the options list
mOptions->RemoveOption(aContent);
@ -689,7 +691,7 @@ nsHTMLSelectElement::RemoveOption(nsIContent* aContent)
// We can't get our index if we've already been replaced in the OptionList.
// If we couldn't get our index, pass -1, remove all options and recreate
// Coincidentally, IndexOf returns -1 if the option isn't found in the list
result = selectFrame->RemoveOption(mOptions->IndexOf(aContent));
result = selectFrame->RemoveOption(oldIndex);
}
}