Bug Tracker

Opened 7 years ago

Closed 7 years ago

#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:
Blocked by: Blocking:

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 (4)

comment:1 Changed 7 years ago by anonymous

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&#39;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.

comment:2 Changed 7 years ago by sindresorhus

Owner: set to jquery@…
Status: newpending

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 7 years 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 7 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

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!

Note: See TracTickets for help on using tickets.