Bug Tracker

Ticket #4321 (closed bug: fixed)

Opened 5 years ago

Last modified 2 years ago

$("#") returns undefined

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

Description

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

Change History

comment:1 Changed 5 years ago by dmethvin

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

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

comment:2 Changed 5 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 4 years ago by rwaldron

  • Keywords regression added
  • Priority changed from major to low
  • Version changed from 1.3.2 to 1.4.3
  • Status changed from new to open
  • Milestone changed from 1.4 to 1.4.4

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

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

comment:7 Changed 3 years ago by danheberden

  • Keywords pullreq added
  • Milestone set to 1.next

comment:8 Changed 3 years ago by dmethvin

  • Keywords regression needsreview pullreq removed

comment:9 Changed 3 years ago by dmethvin

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

Landed pull 160.

comment:10 Changed 3 years ago by dmethvin

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