Opened 13 years ago
Closed 11 years ago
#5179 closed defect (fixed)
dojo.query :selected does not work
Reported by: | guest | Owned by: | alex |
---|---|---|---|
Priority: | high | Milestone: | 1.4 |
Component: | Query | Version: | 1.3.2 |
Keywords: | query checked | Cc: | |
Blocked By: | Blocking: |
Description (last modified by )
The following code returns EVERY input element within a form not just the input elements that are checked (which would make them type=checkbox too)
Accourding to the Dojo documentation HERE it is suppose to return only the Checked elements.
var form = dojo.byId( 'formID' ); var results = dojo.query( "input:checked", form );
I also tried this:
var form = dojo.byId( 'formID' ); var results = dojo.query( "input[type=checkbox][checked]", form );
But it did not return any elements.
Attachments (1)
Change History (14)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
I found the following comment in dojo.query -- I believe we should make this information known in the Documentation on Query so others like me don't waste their time trying to figure out why they don't work.
// Unsupported Selectors: // -------------------- // // While dojo.query handles many CSS3 selectors, some fall outside of // what's resaonable for a programmatic node querying engine to // handle. Currently unsupported selectors include: // // * namespace-differentiated selectors of any form // * "~", the immediately preceeded-by sibling selector // * "+", the preceeded-by sibling selector // * all "::" pseduo-element selectors // * certain pseduo-selectors which don't get a lot of day-to-day use: // * :root, :lang(), :target, :focus // * all visual and state selectors: // * :root, :active, :hover, :visisted, :link, :enabled, :disabled, :checked // * :*-of-type pseudo selectors
comment:3 Changed 13 years ago by
Owner: | changed from anonymous to alex |
---|
comment:4 Changed 13 years ago by
Milestone: | → 1.1 |
---|
comment:5 Changed 13 years ago by
Milestone: | 1.1 → 1.2 |
---|
Move all milestone 1.1 tickets to 1.2, except for reopened tickets and tickets opened after 1.1RC1 was released.
comment:6 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:7 Changed 13 years ago by
Description: | modified (diff) |
---|
note that the CSS 3 working draft has removed the ":selected" pseudo-class in favor of ":checked", which we now implement
comment:8 Changed 12 years ago by
Component: | General → Query |
---|
Changed 12 years ago by
Attachment: | queryPseudoCheckedTest_5179.patch added |
---|
[CLA] [PATCH] Adds failing option:checked test to tests/_base/query.html
comment:9 Changed 12 years ago by
Milestone: | 1.2 → tbd |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
Version: | 1.0 → 1.3.2 |
I've attached a patch for the query test file that adds a test for :checked pseudo as applied to a select option. This passes for me in FF3.5, but fails in IE7 and Safari 4.0
I tried amending the function in query.js, like so:
"checked": function(name, condition){ return function(elem){ return !!d.attr(elem, d.hasAttr(elem, "checked") ? "checked" : "selected"); } },
but while this fixed IE, it seems to still fail in Safari? Not sure if safari is using this branch, or what's going on.
comment:10 Changed 12 years ago by
comment:11 Changed 11 years ago by
Milestone: | tbd → 1.4 |
---|
Failing on IE6 too (unsurprisingly). Should either fix for 1.4 or punt this ticket and comment out the test until it's fixed.
comment:12 Changed 11 years ago by
This seems to be a deficiency in QSA for webkit, and for IE8, so it will need some handling on that side. Probably the easiest is to add :checked to the list of indexOf checks which set useQSA:
(query.indexOf(":contains") == -1) && query.indexOf(":checked") == -1) ...
then, the above change to test hasAttr("checked") and then hasAttr("selected") works in all cases.
The inline docs are a little self-contradictory on this. On one hand they say state selector are not supported, but then go on to say :checked is. If that's the case, this should be fixed. I'll check in the change if I get the nod, the unit test is already in place.
comment:13 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
The title is a little confusing -- I meant to mention that both the :selected and the :checked are broken in this regard.