From f6e45f80b36c988c734f3c5eafda6a8be578f9f8 Mon Sep 17 00:00:00 2001 From: "jst%netscape.com" Date: Fri, 9 Feb 2001 23:45:41 +0000 Subject: [PATCH] Fixing regression bug 68139. Accessing radiobutton.value always returning the defalue value. r=harishd, sr=vidur, a=blizzard@mozilla.org/asa@mozilla.org git-svn-id: svn://10.0.0.236/trunk@86713 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/content/src/nsHTMLInputElement.cpp | 18 ++++++++++-------- .../html/content/src/nsHTMLInputElement.cpp | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/mozilla/content/html/content/src/nsHTMLInputElement.cpp b/mozilla/content/html/content/src/nsHTMLInputElement.cpp index 7895cde9eb5..9c6cb775f4e 100644 --- a/mozilla/content/html/content/src/nsHTMLInputElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLInputElement.cpp @@ -427,19 +427,21 @@ nsHTMLInputElement::GetValue(nsAWritableString& aValue) } return NS_OK; - } else if (type == NS_FORM_INPUT_RADIO) { - // The value of a radio input is always "on". Why you ask? Well, I - // don't know but that's how it appears to work in older - // browsers. -- jst@netscape.com + } + + // Treat value == defaultValue for other input elements + nsresult rv = nsGenericHTMLLeafFormElement::GetAttribute(kNameSpaceID_HTML, + nsHTMLAtoms::value, + aValue); + + if (rv == NS_CONTENT_ATTR_NOT_THERE && type == NS_FORM_INPUT_RADIO) { + // The defauly value of a radio input is "on". aValue.Assign(NS_LITERAL_STRING("on")); return NS_OK; } - // Treat value == defaultValue for other input elements - return nsGenericHTMLLeafFormElement::GetAttribute(kNameSpaceID_HTML, - nsHTMLAtoms::value, - aValue); + return rv; } NS_IMETHODIMP diff --git a/mozilla/layout/html/content/src/nsHTMLInputElement.cpp b/mozilla/layout/html/content/src/nsHTMLInputElement.cpp index 7895cde9eb5..9c6cb775f4e 100644 --- a/mozilla/layout/html/content/src/nsHTMLInputElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLInputElement.cpp @@ -427,19 +427,21 @@ nsHTMLInputElement::GetValue(nsAWritableString& aValue) } return NS_OK; - } else if (type == NS_FORM_INPUT_RADIO) { - // The value of a radio input is always "on". Why you ask? Well, I - // don't know but that's how it appears to work in older - // browsers. -- jst@netscape.com + } + + // Treat value == defaultValue for other input elements + nsresult rv = nsGenericHTMLLeafFormElement::GetAttribute(kNameSpaceID_HTML, + nsHTMLAtoms::value, + aValue); + + if (rv == NS_CONTENT_ATTR_NOT_THERE && type == NS_FORM_INPUT_RADIO) { + // The defauly value of a radio input is "on". aValue.Assign(NS_LITERAL_STRING("on")); return NS_OK; } - // Treat value == defaultValue for other input elements - return nsGenericHTMLLeafFormElement::GetAttribute(kNameSpaceID_HTML, - nsHTMLAtoms::value, - aValue); + return rv; } NS_IMETHODIMP