Skip to main content

Bug Tracker

Side navigation

#11644 closed bug (invalid)

Opened April 25, 2012 02:43PM UTC

Closed May 13, 2012 08:39AM UTC

The 'attribute does not equal' selector fails to process escaped quotation marks whereas the 'attribute equals' selector does.

Reported by: jquery@silasdavis.net Owned by: jquery@silasdavis.net
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.

Attachments (0)
Change History (4)

Changed April 25, 2012 03:15PM UTC by anonymous comment:1

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.

Changed April 25, 2012 06:36PM UTC by sindresorhus comment:2

owner: → jquery@silasdavis.net
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.

Changed April 28, 2012 11:59PM UTC by dmethvin comment:3

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.

Changed May 13, 2012 08:39AM UTC by trac-o-bot comment:4

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!