Bug 1203668 part 1 - Setting the value of a <select> to a non-matching option should deselect all options and set selectedIndex to -1. r=bz

This commit is contained in:
Mats Palmgren
2015-09-12 12:34:37 +02:00
parent b1c3ee7001
commit 5e8eebf6a3
3 changed files with 66 additions and 1 deletions

View File

@@ -1148,9 +1148,11 @@ HTMLSelectElement::SetValue(const nsAString& aValue)
option->GetValue(optionVal);
if (optionVal.Equals(aValue)) {
SetSelectedIndexInternal(int32_t(i), true);
break;
return NS_OK;
}
}
// No matching option was found.
SetSelectedIndexInternal(-1, true);
return NS_OK;
}