jalexiscv / base2

Automatically exported from code.google.com/p/base2
0 stars 0 forks source link

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

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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