RESOLVED FIXED 104873
Validity of a radio button is not updated correctly when it is detached from an invalid radio group
https://bugs.webkit.org/show_bug.cgi?id=104873
Summary Validity of a radio button is not updated correctly when it is detached from ...
Kent Tamura
Reported 2012-12-12 19:14:22 PST
http://code.google.com/p/chromium/issues/detail?id=165464 <form> <input type=radio name=g required id=radio2> <input type=radio name=g required id=radio3> </form> If we remove radio2 from the document tree, it should update validity state and should be valid. However it becomes invalid.
Attachments
Patch (8.75 KB, patch)
2012-12-12 21:03 PST, Kent Tamura
no flags
Patch for landing (8.86 KB, patch)
2012-12-12 21:25 PST, Kent Tamura
no flags
Kent Tamura
Comment 1 2012-12-12 21:03:10 PST
Kentaro Hara
Comment 2 2012-12-12 21:15:19 PST
Comment on attachment 179192 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=179192&action=review > Source/WebCore/html/HTMLInputElement.cpp:1776 > -bool HTMLInputElement::isInRequiredRadioButtonGroup() const > +bool HTMLInputElement::isInRequiredRadioButtonGroup() Why do you need to remove const ? > Source/WebCore/html/HTMLInputElement.h:248 > - bool isInRequiredRadioButtonGroup() const; > + bool isInRequiredRadioButtonGroup(); Ditto. > LayoutTests/fast/forms/radio/radio-live-validation-style.html:37 > +shouldBeTrue('$("radio1").remove(); radio2.remove(); radio2.webkitMatchesSelector(":valid")'); You might want to also check that radio2.webkitMatchesSelector(":valid") is false before removing radio2.
Kent Tamura
Comment 3 2012-12-12 21:20:22 PST
Comment on attachment 179192 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=179192&action=review >> Source/WebCore/html/HTMLInputElement.cpp:1776 >> +bool HTMLInputElement::isInRequiredRadioButtonGroup() > > Why do you need to remove const ? RadioButtonGroup::m_member is a HashSet<HTMLInputElement*> ⇨ RadioButtonGroup::contains needs non-const HTMLInputElement*. ⇨ CheckedRadioButtons::isInRequiredGroup needs non-const HTMLInputElement*. ⇨ HTMLInputElement::isInRequiredRadioButtonGroup needs to be non-const. >> LayoutTests/fast/forms/radio/radio-live-validation-style.html:37 >> +shouldBeTrue('$("radio1").remove(); radio2.remove(); radio2.webkitMatchesSelector(":valid")'); > > You might want to also check that radio2.webkitMatchesSelector(":valid") is false before removing radio2. will do
Kentaro Hara
Comment 4 2012-12-12 21:21:30 PST
(In reply to comment #3) > > Why do you need to remove const ? > > RadioButtonGroup::m_member is a HashSet<HTMLInputElement*> > ⇨ RadioButtonGroup::contains needs non-const HTMLInputElement*. > ⇨ CheckedRadioButtons::isInRequiredGroup needs non-const HTMLInputElement*. > ⇨ HTMLInputElement::isInRequiredRadioButtonGroup needs to be non-const. Makes sense. Thanks for the clarification.
Kent Tamura
Comment 5 2012-12-12 21:25:43 PST
Created attachment 179195 [details] Patch for landing
WebKit Review Bot
Comment 6 2012-12-12 21:45:02 PST
Comment on attachment 179195 [details] Patch for landing Clearing flags on attachment: 179195 Committed r137565: <http://trac.webkit.org/changeset/137565>
WebKit Review Bot
Comment 7 2012-12-12 21:45:06 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.