Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:checked pseudo-class doesn't match selected option elements. #146

Open
GoogleCodeExporter opened this issue Jun 12, 2015 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Load an HTML page which includes a select element with child option elements.
2. Select an option from the select element.
3. Attempt to use the querySelector method to match the selected option element 
using the :checked pseudo-class.

What is the expected output? What do you see instead?
Expected the selected option element to be returned, instead null is returned.

Please use labels and text to provide additional information.
This patch fixes the issue in all the browsers I tested.

--- src/base2/dom/selectors-api/_parser.js      (revision 310)
+++ src/base2/dom/selectors-api/_parser.js      (working copy)
@@ -42,7 +42,7 @@
 _combinators.test["~"] = _combinators.exec["~"].replace("next", "previous");

 var _pseudoClasses = extend({}, {
-  "checked":     "e.checked",
+  "checked":     "e.checked||e.selected",
   "contains":    "e." + Traversal.TEXT_CONTENT + ".indexOf('%1')!=-1",
   "disabled":    "e.disabled===true",
   "empty":       "Traversal.isEmpty(e)",

Original issue reported on code.google.com by pdeb...@staff.iinet.net.au on 30 Aug 2012 at 6:17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant