Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#6850 closed bug

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:

Description

$('<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.

Change History (3)

comment:1 Changed 10 years ago by SlexAxton

Keywords: child selector added
Milestone: 1.4.31.5
Priority: low
Status: newopen

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

comment:2 Changed 10 years ago by SlexAxton

Owner: set to 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.

comment:3 Changed 10 years ago by trac-o-bot

Status: pendingclosed

Automatically closed due to 14 days of inactivity.

Note: See TracTickets for help on using tickets.