Modify ↓
Ticket #212 (closed: invalid)
Rhonda
| Reported by: | 3568@… | Owned by: | |
|---|---|---|---|
| Priority: | Milestone: | ||
| Component: | Version: | ||
| Keywords: | Rhonda,SPAM | Cc: | |
| Blocking: | Blocked by: |
Description
If I have document <div id=lst></div> then $(‘#lst/div’).length gives error, but $(‘#lst’).find(‘div’).length gives 0
Rev: 249 Date: 2006-08-31 13:26:31 -0400 (Thu, 31 Aug 2006)
Change History
comment:2 Changed 7 years ago by joern
- Status changed from new to closed
- Resolution set to fixed
sibling() is fixed in SVN.
comment:3 Changed 7 years ago by substitute
- Status changed from closed to reopened
- Cc "" added
- Type bug deleted
- Component core deleted
- Priority major deleted
- Milestone 1.0 deleted
- Resolution fixed deleted
comment:4 Changed 7 years ago by joern
- Priority set to blocker
- Resolution set to invalid
- Status changed from reopened to closed
- Component set to ajax
- Type set to bug
SPAMPOLICE
comment:5 Changed 7 years ago by Rhonda
- Cc Rhonda added; "" removed
- Component changed from ajax to 1
- Summary changed from $('node1/node2') gives error when node1 is empty to Rhonda
- Priority changed from blocker to 1
- Version set to 1
- Milestone set to 1
- Keywords Rhonda added; find subling removed
- Type changed from bug to 1
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

The same problem also occurs with "#lst > div". This seems to be because the method for evaluating the ">" and "/" tokens sends #lst's firstChild to jQuery.sibling(), which then tries to get its parentNode. Boom! Null element reference doesn't have a parentNode! It can probably be fixed by
A) making jQuery.sibling() check for a null value for its 'elem' argument or
B) changing jQuery.token[3] to something like "a.firstChild?jQuery.sibling(a.firstChild):[]".