[Webkit-unassigned] [Bug 35472] New: HTML5: radioWidget.checkValidity()  broken - always returns false

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Feb 27 01:21:35 PST 2010


https://bugs.webkit.org/show_bug.cgi?id=35472

           Summary: HTML5: radioWidget.checkValidity() broken - always
                    returns false
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: New Bugs
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: webkit at appsforartists.com


What steps will reproduce the problem?
1. Create an input group of the type 'radio' with @required set.
2. Check one of the boxes.
3. Call widget.checkValidity()

What is the expected result?
If any box in the group is checked, the whole control is valid. 
widget.checkValidity() should return true.

What happens instead?
widget.checkValidity() always returns false if a radio group is required, and
causes document.forms[0].checkValidity() to also return false.  It does this
even if a button is checked (which defies the spec), or if the button you call
it against is checked (which defies logic).

Please provide any additional information below.

>From the HTML5 spec:

    "Constraint validation: If the element is required and all of the input
elements in the radio button group have a checkedness that is false, then the
element is suffering from being missing."

Although not technically a regression, this bug breaks existing sites.  Any
site that was using feature detection to call the HTML5 validity API no longer
works.  document.forms[0].checkValidity is not null, so the native API will be
used; however, this bug makes any form with a required radio group fail the
checkValidity test.  This can prevent forms from being submitted.

ImARegular.com has begun to receive reports that our surveys no longer work in
Chrome.

The workaround is to use the attached JavaScript code to detect is the HTML5
validity API is properly supported.  It also functions as a test case.

Chromium Bug:
http://code.google.com/p/chromium/issues/detail?id=36962

--------
Test case
--------

var hasCheckValidity = document.forms[0].checkValidity;

if (hasCheckValidity) {
    var testForm = document.createElement('form');
    var testInput = [];
    var addTestWidget = function(i) {
        testInput[i] = document.createElement('input');
        testInput[i].type = 'radio';
        testInput[i].required = 'required';
        testInput[i].name = 'radio_validity_test';
        testInput[i].value = i;
        testForm.appendChild(testInput[i]);
    }
    addTestWidget(0);
    addTestWidget(1);
    testInput[0].checked = true;
    hasCheckValidity = testInput[1].checkValidity();
}

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list