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

git-svn-id: svn://10.0.0.236/trunk@44496 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rods%netscape.com
1999-08-25 13:44:49 +00:00
parent 15e0954387
commit 9b3d301a91
2 changed files with 6 additions and 2 deletions

View File

@@ -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);
}
}

View File

@@ -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);
}
}