Bug 63192 - :checked pseudo selector not matching selected option
Summary: :checked pseudo selector not matching selected option
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://jsfiddle.net/5dqPv/31/
Keywords:
Depends on:
Blocks: HTML5Forms
  Show dependency treegraph
 
Reported: 2011-06-22 15:17 PDT by karl.bohlmark
Modified: 2011-10-11 20:44 PDT (History)
7 users (show)

See Also:


Attachments
test case (260 bytes, text/html)
2011-06-23 01:48 PDT, karl.bohlmark
no flags Details
Patch (5.08 KB, patch)
2011-10-11 04:21 PDT, Sameer Patil
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description karl.bohlmark 2011-06-22 15:17:54 PDT
The :checked pseudo selector is not matched by select options that have the "selected" attribute. The spec clearly states that :checked should match form elements that have the "checked" or "selected" attributes.

Test case: http://jsfiddle.net/5dqPv/11/

Tested in webkit nightly.
Comment 1 Shane Stephens 2011-06-22 21:21:00 PDT
Your test case doesn't demonstrate the behavior claimed in this bug - the letter-spacing property doesn't apply to option elements even in the absence of a :checked selector.  Please provide a test case that demonstrates the behavior.
Comment 2 karl.bohlmark 2011-06-23 00:38:44 PDT
Ok, I changed the test case to demonstrating it using querySelectorAll

http://jsfiddle.net/5dqPv/31/
Comment 3 Alexey Proskuryakov 2011-06-23 00:56:28 PDT
Please attach your test case to the bug. There is no reason to keep tests on jsfiddle.
Comment 4 karl.bohlmark 2011-06-23 01:48:29 PDT
Created attachment 98323 [details]
test case
Comment 5 Shane Stephens 2011-06-23 16:30:33 PDT
Nice test case :)  I couldn't find a property that applied to both selected and unselected option elements (e.g. background-color and color apply to the unselected elements but are overridden by the selection highlight).
Comment 6 Sameer Patil 2011-10-11 04:21:21 PDT
Created attachment 110499 [details]
Patch

Option element selected state need to be checked in PseudoChecked, currently HTMLInput elements are checked on their checked state. I guess option elements do require check here if we want them to be considered as checked when it's state is selected.
Comment 7 Kent Tamura 2011-10-11 19:14:44 PDT
Comment on attachment 110499 [details]
Patch

ok
Comment 8 Sameer Patil 2011-10-11 20:29:44 PDT
Comment on attachment 110499 [details]
Patch

Thanks for review. Setting the commit-queue flag.
Comment 9 WebKit Review Bot 2011-10-11 20:44:53 PDT
Comment on attachment 110499 [details]
Patch

Clearing flags on attachment: 110499

Committed r97224: <http://trac.webkit.org/changeset/97224>
Comment 10 WebKit Review Bot 2011-10-11 20:44:58 PDT
All reviewed patches have been landed.  Closing bug.