Skip to main content

Bug Tracker

Side navigation

#11449 closed bug (invalid)

Opened March 07, 2012 04:37PM UTC

Closed March 07, 2012 04:49PM UTC

Colon character in attributeHas (Browser compatibility)

Reported by: mark.andrus Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:
Description

Given the markup

<div class="button" data-namespace:id="1"></div>

jQuery 1.7.1 will correctly parse the following in the latest Chrome for OS X, but not in the latest Safari or Firefox on OS X, nor in the latest Chrome or the latest IE in Windows 7

jQuery('.button[data-namespace:id="1"]')
Attachments (0)
Change History (2)

Changed March 07, 2012 04:40PM UTC by mark.andrus comment:1

_comment0: Here is a jsFiddle demonstrating the issue: http://jsfiddle.net/j84KA/1331138739116933

Here is a jsFiddle demonstrating the issue: http://jsfiddle.net/j84KA/

EDIT: Looks like two backslashes solves the problem, but this isn't mentioned in the docs

jQuery('.button[data-namespace\\\\:id="1"]')

Changed March 07, 2012 04:49PM UTC by ajpiano comment:2

resolution: → invalid
status: newclosed

Thanks for taking the time to try to help out the jQuery project, but this is not a valid bug. As is clearly stated in the selector documentation: "'If you wish to use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[\\]`{|}~ ) as a literal part of a name, you must escape the character with two backslashes:"

As you can see, once the selector is escaped, it works fine. http://jsfiddle.net/j84KA/1/