Skip to main content

Bug Tracker

Side navigation

#6850 closed bug ()

Opened July 29, 2010 07:35PM UTC

Closed November 11, 2010 11:09PM UTC

Last modified March 13, 2012 09:32PM UTC

Error in deep > selectors when root node has no parent

Reported by: dept42 Owned by: dept42
Priority: low Milestone: 1.5
Component: selector Version: 1.4.2
Keywords: child selector Cc:
Blocked by: Blocking:

$('<div/>').append('<div/>').find('div > div > div')

TypeError: parent is null { message="parent is null", more...}

parent is null

checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;

jquery...0431143 (line 2963)

For some reason the .append call seems necessary to triggering the bug.

It can be fixed by changing line 2963 to:

checkSet[i] = parent && parent.nodeName.toLowerCase() === part ? parent : false;

But I'm not sure whether that's the real solution, or if this is indicative of some deeper bug. It seems odd that the root node appears in checkSet in this situation to begin with, but I don't really understand the full context for this section of code.

Attachments (0)
Change History (3)

Changed October 27, 2010 06:32PM UTC by SlexAxton comment:1

keywords: → child selector
priority: → low
status: newopen

These seems like an easy enough fix. Low hanging fruit.

Changed October 27, 2010 06:36PM UTC by SlexAxton comment:2

owner: → dept42
status: openpending

Just checked this in the current git repo and it seems to be fixed. Let me know if you have different results.

Changed November 11, 2010 11:09PM UTC by trac-o-bot comment:3

status: pendingclosed

Automatically closed due to 14 days of inactivity.