changed the way white space was being compress when getting the value

now a value of all spaces does get compressed to nothing
This commit is contained in:
rods%netscape.com 1999-09-08 19:57:24 +00:00
parent d88c66a30a
commit 344f8d53df
2 changed files with 18 additions and 2 deletions

View File

@ -450,7 +450,15 @@ nsHTMLOptionElement::GetText(nsString& aText)
rv = node->QueryInterface(kIDOMTextIID, (void**)&domText);
if (NS_SUCCEEDED(rv) && domText) {
rv = domText->GetData(aText);
aText.CompressWhitespace(PR_TRUE, PR_TRUE);
// the option could be all spaces, so compress the white space
// then make sure the length is greater than zero
if (aText.Length() > 0) {
nsAutoString compressText = aText;
compressText.CompressWhitespace(PR_TRUE, PR_TRUE);
if (compressText.Length() != 0) {
aText = compressText;
}
}
NS_RELEASE(domText);
NS_RELEASE(node);
break;

View File

@ -450,7 +450,15 @@ nsHTMLOptionElement::GetText(nsString& aText)
rv = node->QueryInterface(kIDOMTextIID, (void**)&domText);
if (NS_SUCCEEDED(rv) && domText) {
rv = domText->GetData(aText);
aText.CompressWhitespace(PR_TRUE, PR_TRUE);
// the option could be all spaces, so compress the white space
// then make sure the length is greater than zero
if (aText.Length() > 0) {
nsAutoString compressText = aText;
compressText.CompressWhitespace(PR_TRUE, PR_TRUE);
if (compressText.Length() != 0) {
aText = compressText;
}
}
NS_RELEASE(domText);
NS_RELEASE(node);
break;