Bug 63192

Summary: :checked pseudo selector not matching selected option
Product: WebKit Reporter: karl.bohlmark
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, koivisto, mkrp87, shanestephens, simon.fraser, tkent, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
URL: http://jsfiddle.net/5dqPv/31/
Bug Depends on:    
Bug Blocks: 19264    
Attachments:
Description Flags
test case
none
Patch none

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.