Bug 16704

Summary: input with type="hidden" matches :enabled/:disabled (Acid3 bug)
Product: WebKit Reporter: Eric Seidel (no email) <eric>
Component: CSSAssignee: Beth Dakin <bdakin>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin
Priority: P2 Keywords: NeedsReduction
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
Patch: Prevent :enabled and :disabled from applying to input type="hidden" oliver: review+

Eric Seidel (no email)
Reported 2008-01-01 22:17:31 PST
input with type="hidden" matches :enabled/:disabled (Acid3 bug) function () { // test 42: :enabled, :disabled, :checked, etc selectorTest(function (doc, add, expect) { var input = doc.createElement('input'); input.type = 'checkbox'; doc.body.appendChild(input); var neither = 0; var both = add(":checked:enabled"); var checked = add(":checked"); var enabled = add(":enabled"); expect(doc.body, neither, "control failure"); expect(input, enabled, "input element didn't match :enabled"); input.click(); expect(input, both, "input element didn't match :checked"); input.disabled = true; expect(input, checked, "failure 3"); input.checked = false; expect(input, neither, "failure 4"); expect(doc.body, neither, "failure 5"); }); selectorTest(function (doc, add, expect) { var input1 = doc.createElement('input'); input1.type = 'radio'; input1.name = 'radio'; doc.body.appendChild(input1); var input2 = doc.createElement('input'); input2.type = 'radio'; input2.name = 'radio'; doc.body.appendChild(input2); var checked = add(":checked"); expect(input1, 0, "failure 6"); expect(input2, 0, "failure 7"); input2.checked = true; expect(input1, 0, "failure 6"); expect(input2, checked, "failure 7"); input1.checked = true; expect(input1, checked, "failure 8"); expect(input2, 0, "failure 9"); input2.setAttribute("checked", "checked"); // sets defaultChecked, doesn't change actual state expect(input1, checked, "failure 9"); expect(input2, 0, "failure 10"); }); selectorTest(function (doc, add, expect) { var input = doc.createElement('input'); input.type = 'button'; doc.body.appendChild(input); var neither = 0; var enabled = add(":enabled"); var disabled = add(":disabled"); add(":enabled:disabled"); expect(input, enabled, "failure 11"); input.disabled = true; expect(input, disabled, "failure 12"); input.removeAttribute("disabled"); expect(input, enabled, "failure 13"); input.setAttribute("type", "hidden"); expect(input, neither, "an input with type=hidden is matching one of :enabled or :disabled"); }); return 3; }, We'll need to make a nicer stand-alone test case.
Attachments
Patch: Prevent :enabled and :disabled from applying to input type="hidden" (6.96 KB, patch)
2008-01-04 20:56 PST, Beth Dakin
oliver: review+
Beth Dakin
Comment 1 2008-01-04 20:56:09 PST
Created attachment 18282 [details] Patch: Prevent :enabled and :disabled from applying to input type="hidden" I verified that this fixes the test in Acid3.
Oliver Hunt
Comment 2 2008-01-04 21:00:17 PST
Comment on attachment 18282 [details] Patch: Prevent :enabled and :disabled from applying to input type="hidden" r=me, my only requirement is that you do layoutController.dumpAsText() (or whatever the controller is called) There's n o need for this to be a render tree comparison
Oliver Hunt
Comment 3 2008-01-04 21:19:22 PST
Fixed with r29191.
Adele Peterson
Comment 4 2008-01-04 22:40:36 PST
would it be better to check that a renderer exists instead of special casing the hidden input?
Adele Peterson
Comment 5 2008-01-04 22:42:06 PST
that would cause enabled controls that have display:none set to no longer match those rules...which might not be desirable.
Note You need to log in before you can comment on or make changes to this bug.