Changeset 20333 in webkit
- Timestamp:
- Mar 19, 2007, 5:30:49 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r20326 r20333 1 2007-03-19 Adele Peterson <adele@apple.com> 2 3 Reviewed by Beth. 4 5 Test for http://bugs.webkit.org/show_bug.cgi?id=13087 6 <rdar://problem/5064316> REGRESSION: Allow setting the checked attribute in js and in markup for unnamed radio buttons (dominos.com) 7 8 * fast/forms/radio_checked_name-expected.txt: Added. 9 * fast/forms/radio_checked_name.html: Added. 10 1 11 2007-03-19 Justin Garcia <justin.garcia@apple.com> 2 12 -
trunk/WebCore/ChangeLog
r20332 r20333 1 2007-03-19 Adele Peterson <adele@apple.com> 2 3 Reviewed by Beth. 4 5 Fix for http://bugs.webkit.org/show_bug.cgi?id=13087 6 <rdar://problem/5064316> REGRESSION: Allow setting the checked attribute in js and in markup for unnamed radio buttons (dominos.com) 7 8 Test: fast/forms/radio_checked_name.html 9 10 We were matching a WinIE quirk that does not allow a user to check and uncheck an unnamed radio button. But they still 11 allow the checked attribute to be set in html, and changed in javascript. So this change matches that behavior. 12 13 * html/HTMLInputElement.cpp: 14 (WebCore::HTMLInputElement::parseMappedAttribute): We no longer need a special call to setChecked when parsing the name 15 attribute, since we setChecked will now work with unnamed radio buttons. 16 (WebCore::HTMLInputElement::preDispatchEventHandler): Added comment. 17 (WebCore::HTMLInputElement::setChecked): Don't check for the unnamed radio button case here. 18 (WebCore::HTMLInputElement::postDispatchEventHandler): Don't call setChecked for unnamed radio buttons. 19 (WebCore::HTMLInputElement::defaultEventHandler): ditto. 20 1 21 2007-03-19 Adam Roben <aroben@apple.com> 2 22 -
trunk/WebCore/html/HTMLInputElement.cpp
r20214 r20333 585 585 586 586 if (inputType() == RADIO) { 587 // In case we parsed the checked attribute first, call setChecked if the element is checked by default.588 if (m_useDefaultChecked)589 setChecked(m_defaultChecked);590 587 // Add the button to its new group. 591 588 if (checked()) … … 880 877 void HTMLInputElement::setChecked(bool nowChecked, bool sendChangeEvent) 881 878 { 882 // We mimic WinIE and don't allow unnamed radio buttons to be checked. 883 if (checked() == nowChecked || (inputType() == RADIO && name().isEmpty())) 879 if (checked() == nowChecked) 884 880 return; 885 881 … … 1060 1056 // For radio buttons, store the current selected radio object. 1061 1057 if (name().isEmpty() || checked()) 1062 return 0; // Unnamed radio buttons dont get checked. Checked buttons just stay checked. 1058 return 0; // Match WinIE and don't allow unnamed radio buttons to be checked. 1059 // Checked buttons just stay checked. 1063 1060 // FIXME: Need to learn to work without a form. 1064 1061 … … 1097 1094 // Make sure it is still a radio button and only do the restoration if it still 1098 1095 // belongs to our group. 1099 if (input->form() == form() && input->inputType() == RADIO && input->name() == name()) { 1096 1097 // Match WinIE and don't allow unnamed radio buttons to be checked. 1098 if (input->form() == form() && input->inputType() == RADIO && !name().isEmpty() && input->name() == name()) { 1100 1099 // Ok, the old radio button is still in our form and in our group and is still a 1101 1100 // radio button, so it's safe to restore selection to it. … … 1253 1252 break; 1254 1253 if (n->hasTagName(inputTag)) { 1254 // Match WinIE and don't allow unnamed radio buttons to be checked. 1255 1255 HTMLInputElement* inputElt = static_cast<HTMLInputElement*>(n); 1256 if (inputElt->inputType() == RADIO && inputElt->name() == name() && 1257 inputElt->isFocusable()) { 1256 if (inputElt->inputType() == RADIO && !name().isEmpty() && inputElt->name() == name() && inputElt->isFocusable()) { 1258 1257 inputElt->setChecked(true); 1259 1258 document()->setFocusedNode(inputElt);
Note:
See TracChangeset
for help on using the changeset viewer.