Ticket #11300 (closed enhancement: fixed)
Docs Bug: The :contains() selector statement about quotes is confusing...
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | attributes | Version: | 1.7.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Change History
comment:1 Changed 17 months ago by dmethvin
- Keywords needsdocs added
- Priority changed from undecided to low
- Component changed from unfiled to attributes
- Type changed from bug to enhancement
comment:2 Changed 17 months ago by dmethvin
- Status changed from new to closed
- Resolution set to fixed
Docs updated.
comment:3 Changed 17 months ago by anonymous
Replying to dmethvin:
Docs updated.
I see you updated the docs for the attribute-equals-selector, but the other various attribute selectors still state...
"Quotes are mandatory."
Is this intentional? If so, could you please explain the reason for the different requirements.
If it helps, the following is a list of attribute selectors that have not been updated...
- h ttp://api.jquery.com/attribute-contains-prefix-selector/
- h ttp://api.jquery.com/attribute-contains-selector/
- h ttp://api.jquery.com/attribute-contains-word-selector/
- h ttp://api.jquery.com/attribute-ends-with-selector/
- h ttp://api.jquery.com/attribute-not-equal-selector/
- h ttp://api.jquery.com/attribute-starts-with-selector/
(Sorry for the broken links, but it's getting spam-blocked.)
FWIW, I tested each one using querySelectorAll in Chrome 17, and the only one that throws is the not equal selector, but that seems to be because it's a non-standard selector. Quotes made no difference either way.
comment:4 follow-up: ↓ 5 Changed 17 months ago by dmethvin
Yep, should have fixed those too. I'll get to it this afternoon.
Trac is more friendly if you create an account, otherwise it's pretty aggressive about potential spam. We get a *lot* of spam.
comment:5 in reply to: ↑ 4 Changed 16 months ago by anonymous
Replying to dmethvin:
Yep, should have fixed those too. I'll get to it this afternoon.
My apologies for not catching this before, but there's one more page that would need updating.
It's the Category page for Selectors > Attribute
http://api.jquery.com/category/selectors/attribute-selectors/
The current wording is...
"Attribute values in selector expressions must be surrounded by quotation marks."
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Yeah, neither is quite accurate. Quotes are only mandatory for attribute values if they are not identifiers, so [type=text] is fine. I am not sure of the specifics of :contains() but it seems we should encourage the same rule regardless of how it's currently implemented.