#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 12 years ago by
Keywords: | child selector added |
---|---|
Milestone: | 1.4.3 → 1.5 |
Priority: | → low |
Status: | new → open |
comment:2 Changed 12 years ago by
Owner: | set to dept42 |
---|---|
Status: | open → pending |
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 12 years ago by
Status: | pending → closed |
---|
Automatically closed due to 14 days of inactivity.
These seems like an easy enough fix. Low hanging fruit.