Bug Tracker

Opened 15 years ago

Closed 12 years ago

Last modified 12 years ago

#4321 closed bug (fixed)

$("#") returns undefined

Reported by: vkvkvk Owned by: Rick Waldron
Priority: low Milestone: 1.6
Component: selector Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:

Description

$("#") returns "undefined". Opera ver 9.6 throws exception. Old version JQuery returns JQuery object (length=0)

Change History (10)

comment:1 Changed 14 years ago by dmethvin

Component: unfilledselector
Owner: set to john

It's an error case...I guess it should return an empty object though.

comment:2 Changed 14 years ago by davidserduke

Seems like a pretty specific and rare special case that isn't worth expanding the code base to fix. That said I think this might work and not require any more code (needs more testing though):

Change

quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/

to

quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]*)$/

which is just changing + which requires at least one character to * which doesn't (this special case where input is "#").

comment:3 Changed 13 years ago by Rick Waldron

Keywords: regression added
Milestone: 1.41.4.4
Priority: majorlow
Status: newopen
Version: 1.3.21.4.3

Confirmed; However this is not documented in the API as a valid selector, however IS a regression in behaviour

exception thrown in 1.4.4rc1 http://jsfiddle.net/rwaldron/eHtAU/2/

passes with 1.2.6 http://jsfiddle.net/rwaldron/eHtAU/3/

comment:4 Changed 13 years ago by snover

Keywords: needsreview added
Milestone: 1.4.4

Retargeting to future since this is not likely to actually affect anyone.

comment:5 Changed 13 years ago by Rick Waldron

Owner: changed from john to Rick Waldron
Status: openassigned

comment:7 Changed 12 years ago by danheberden

Keywords: pullreq added
Milestone: 1.next

comment:8 Changed 12 years ago by dmethvin

Keywords: regression needsreview pullreq removed

comment:9 Changed 12 years ago by dmethvin

Resolution: fixed
Status: assignedclosed

Landed pull 160.

comment:10 Changed 12 years ago by dmethvin

Milestone: 1.next1.6
Note: See TracTickets for help on using tickets.