Bug Tracker

Opened 6 years ago

Closed 6 years ago

#14532 closed bug (notabug)

ID selector fail with ':' in the id

Reported by: darrenrh@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:

Description

IDs with ':' aren't found by the ID selector. Using HTML5 so IDs should be valid with a number first.

It works in Pure JS and in at least one other framework, Mootools 1.4.5.

http://jsfiddle.net/Ax3rP/4/

Converting a small project from mootools 1.4.5 to jquery 1.10.2 and it caused me a lot of confusion

Change History (1)

comment:1 Changed 6 years ago by timmywil

Resolution: notabug
Status: newclosed

The colon must be escaped: http://jsfiddle.net/Ax3rP/6/.

Always escape selectors as if you were passing them to querySelectorAll, not getElementById. jQuery will normalize the selector for you and still use getElementbyId internally for performance.

http://api.jquery.com/id-selector/

Note: See TracTickets for help on using tickets.