Bug Tracker

Opened 13 years ago

Closed 13 years ago

#1261 closed bug (duplicate)

jQuery 1.1.2 causes JS error with nested id selectors of non-existent elements

Reported by: jazer Owned by:
Priority: major Milestone: 1.1.3
Component: core Version: 1.1.2
Keywords: Cc:
Blocked by: Blocking:

Description

A nested id selector, e.g. $("#foo #bar") will cause an error when used in a document that does not contain the targeted element.

The error (as reported by Firebug) is "ret[ret.length - 1] has no properties".

Here's the entire error output:

ret[ret.length - 1] has no properties

find("#bar", Document u.html) jquery-latest.js (line 968)

find(Document u.html) jquery-latest.js (line 186)

map([Document u.html], function()) jquery-latest.js (line 636)

find("#foo #bar") jquery-latest.js (line 185)

jQuery("#foo #bar", undefined) jquery-latest.js (line 38)

jQuery("#foo #bar", undefined) jquery-latest.js (line 19)

(no name)() u.html (line 18)

to the wait list jQuery.readyList.push() jquery-latest.js (line 1430)

(no name)() jquery-latest.js (line 1455)

each([function()], function(), undefined) jquery-latest.js (line 312)

ready() jquery-latest.js (line 1454)

[Break on this error] if ( m[1] == "#" && ret[ret.length-1].getElementById ) {

Change History (1)

comment:1 Changed 13 years ago by brandon

Resolution: duplicate
Status: newclosed

Duplicate of #895

Note: See TracTickets for help on using tickets.