Bug 1358448 - Add radio back to a radio group after moving out of a form. r=smaug
The container of a radio group is the form, if it belongs to a form, or the document object otherwise. When moving a radio out of a form, we should add it back to a radio group. Similary, before moving the radio to a form, we should remove it from the original radio group. MozReview-Commit-ID: 22WsEhz2SXH
This commit is contained in:
@@ -1550,6 +1550,27 @@ HTMLInputElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
aValue, aNotify);
|
||||
}
|
||||
|
||||
void
|
||||
HTMLInputElement::BeforeSetForm(bool aBindToTree)
|
||||
{
|
||||
// No need to remove from radio group if we are just binding to tree.
|
||||
if (mType == NS_FORM_INPUT_RADIO && !aBindToTree) {
|
||||
WillRemoveFromRadioGroup();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
HTMLInputElement::AfterClearForm(bool aUnbindOrDelete)
|
||||
{
|
||||
MOZ_ASSERT(!mForm);
|
||||
|
||||
// Do not add back to radio group if we are releasing or unbinding from tree.
|
||||
if (mType == NS_FORM_INPUT_RADIO && !aUnbindOrDelete) {
|
||||
AddedToRadioGroup();
|
||||
UpdateValueMissingValidityStateForRadio(false);
|
||||
}
|
||||
}
|
||||
|
||||
// nsIDOMHTMLInputElement
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
||||
Reference in New Issue
Block a user