Bug Tracker

Opened 7 years ago

Closed 5 years ago

Last modified 4 years ago

#4321 closed bug (fixed)

$("#") returns undefined

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


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

Change History (10)

comment:1 Changed 6 years ago by dmethvin

  • Component changed from unfilled to selector
  • Owner set to john

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

comment:2 Changed 6 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):


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


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 5 years ago by rwaldron

  • Keywords regression added
  • Milestone changed from 1.4 to 1.4.4
  • Priority changed from major to low
  • Status changed from new to open
  • Version changed from 1.3.2 to 1.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 5 years ago by snover

  • Keywords needsreview added
  • Milestone 1.4.4 deleted

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

comment:5 Changed 5 years ago by rwaldron

  • Owner changed from john to rwaldron
  • Status changed from open to assigned

comment:7 Changed 5 years ago by danheberden

  • Keywords pullreq added
  • Milestone set to 1.next

comment:8 Changed 5 years ago by dmethvin

  • Keywords regression needsreview pullreq removed

comment:9 Changed 5 years ago by dmethvin

  • Resolution set to fixed
  • Status changed from assigned to closed

Landed pull 160.

comment:10 Changed 5 years ago by dmethvin

  • Milestone changed from 1.next to 1.6
Note: See TracTickets for help on using tickets.