Ticket #11644 (closed bug: invalid)
The 'attribute does not equal' selector fails to process escaped quotation marks whereas the 'attribute equals' selector does.
| Reported by: | jquery@… | Owned by: | jquery@… |
|---|---|---|---|
| Priority: | undecided | Milestone: | None |
| Component: | unfiled | Version: | 1.5.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
The following 'attribute equals' selector executes sucessfully and finds results:
$("[label=\"Amy\\'s Shoe\"]")
However the same argument for the 'attribute does not equal' selector fails:
$("[label!=\"Amy\\'s Shoe\"]")
With:
Syntax error, unrecognized expression: Shoe"]
The simplest failing example is:
$("[label!=\"\\'"]")
Clearly this is inconsistent and I think the escaping should work. I am yet to experiment with entity encoded strings.
Change History
comment:2 Changed 13 months ago by sindresorhus
- Owner set to jquery@…
- Status changed from new to pending
Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.
Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.
comment:3 Changed 13 months ago by dmethvin
This is most likely because [attr=value] is standard CSS and processed by querySelectorAll but [attr!=value] is a jQuery selector extension so it goes through an entirely different code path. A thorough test case with all your experiments would be appreciated.
comment:4 Changed 13 months ago by trac-o-bot
- Status changed from pending to closed
- Resolution set to invalid
Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

I have since tried:
$('[label="Amy's Shoe"]')But this selector does not find the element with the label "Amy's Shoe", even though it appears in the literal source with the entity escaping form (as <optgroup label="Amy's Shoe">). Whereas the following does find the element:
$('[label="Amy\\\'s Shoe"]')So I surmise that I cannot rely on the entity escaped form for the 'attribute does not equal' selector either.