Bug 12348: Setting DefaultChecked now also updates Checked, per DOM Errata

This commit is contained in:
pollmann%netscape.com 1999-09-16 20:03:04 +00:00
Родитель bd5a9ff755
Коммит beb970a988
2 изменённых файлов: 18 добавлений и 8 удалений

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

@ -293,13 +293,18 @@ nsHTMLInputElement::GetDefaultChecked(PRBool* aDefaultChecked)
NS_IMETHODIMP
nsHTMLInputElement::SetDefaultChecked(PRBool aDefaultChecked)
{
nsresult rv = NS_OK;
nsHTMLValue empty(eHTMLUnit_Empty);
if (aDefaultChecked) {
return mInner.SetHTMLAttribute(nsHTMLAtoms::checked, empty, PR_TRUE);
rv = mInner.SetHTMLAttribute(nsHTMLAtoms::checked, empty, PR_TRUE);
} else {
mInner.UnsetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, PR_TRUE);
return NS_OK;
}
rv = mInner.UnsetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, PR_TRUE);
}
if (NS_SUCCEEDED(rv)) {
//When setting DefaultChecked, we must also reset Checked (DOM Errata)
SetChecked(aDefaultChecked);
}
return rv;
}
//NS_IMPL_STRING_ATTR(nsHTMLInputElement, DefaultValue, defaultvalue)

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

@ -293,13 +293,18 @@ nsHTMLInputElement::GetDefaultChecked(PRBool* aDefaultChecked)
NS_IMETHODIMP
nsHTMLInputElement::SetDefaultChecked(PRBool aDefaultChecked)
{
nsresult rv = NS_OK;
nsHTMLValue empty(eHTMLUnit_Empty);
if (aDefaultChecked) {
return mInner.SetHTMLAttribute(nsHTMLAtoms::checked, empty, PR_TRUE);
rv = mInner.SetHTMLAttribute(nsHTMLAtoms::checked, empty, PR_TRUE);
} else {
mInner.UnsetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, PR_TRUE);
return NS_OK;
}
rv = mInner.UnsetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, PR_TRUE);
}
if (NS_SUCCEEDED(rv)) {
//When setting DefaultChecked, we must also reset Checked (DOM Errata)
SetChecked(aDefaultChecked);
}
return rv;
}
//NS_IMPL_STRING_ATTR(nsHTMLInputElement, DefaultValue, defaultvalue)