Skip to main content

Bug Tracker

Side navigation

#900 closed bug (fixed)

Opened January 31, 2007 02:35PM UTC

Closed January 31, 2007 09:06PM UTC

Last modified June 19, 2007 08:13AM UTC

get(0) or [0] on an empty resultset returns the document element

Reported by: Owned by:
Priority: minor Milestone:
Component: core Version:
Keywords: Cc:
Blocked by: Blocking:

On the packed and unpacked version downloadable on, you get the following inconsistent behaviour :

Lookup for an element that doesn't exist :

var x = $('#something') // => [ ]
x[0]                    // => Document
x.get(0)                // => Document

Here is the code I've used to reproduce the bug :



<title>Jquery bug</title>

<script type="text/javascript" src=""></script>

<script type="text/javascript">

$(function() {

alert($('#kdjgldsg').get(0)); // should be null





<h1>Hello world</h1>



Attachments (0)
Change History (1)

Changed January 31, 2007 09:06PM UTC by joern comment:1

resolution: → fixed
status: newclosed

Fixed some revisions ago, will be included in 1.1.2