#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
| Component: | unfilled → selector |
|---|---|
| Owner: | set to john |
comment:2 Changed 14 years ago by
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
| Keywords: | regression added |
|---|---|
| Milestone: | 1.4 → 1.4.4 |
| Priority: | major → low |
| Status: | new → open |
| Version: | 1.3.2 → 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 13 years ago by
| Keywords: | needsreview added |
|---|---|
| Milestone: | 1.4.4 |
Retargeting to future since this is not likely to actually affect anyone.
comment:5 Changed 12 years ago by
| Owner: | changed from john to Rick Waldron |
|---|---|
| Status: | open → assigned |
comment:7 Changed 12 years ago by
| Keywords: | pullreq added |
|---|---|
| Milestone: | → 1.next |
comment:8 Changed 12 years ago by
| Keywords: | regression needsreview pullreq removed |
|---|
comment:10 Changed 12 years ago by
| Milestone: | 1.next → 1.6 |
|---|

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