Ticket #4224 (closed bug: wontfix)
selecting with space does not go deep
| Reported by: | Sjeiti | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.4 |
| Component: | selector | Version: | 1.3.2 |
| Keywords: | selector space | Cc: | |
| Blocking: | Blocked by: |
Description
with a deep list <ul><li>a</li><li>b<ul><li>ba</li><ul></li><ul> $("li").length returns 3 (correct) $("body>ul li").length returns 2 (incorrect)
looks like space is read as >
Attachments
Change History
comment:2 Changed 4 years ago by dmethvin
- Status changed from new to closed
- Resolution set to invalid
Closed for inactivity; reopen with a test case if the problem still exists.
Changed 4 years ago by Sjeiti
-
attachment
index.html
added
tested xhtml strict proof for 4224 (add jquery-1.3.2.min.js yourself)
comment:3 in reply to: ↑ 1 Changed 4 years ago by Sjeiti
- Status changed from closed to reopened
- Resolution invalid deleted
Ah well, error in the post. But the bug is there. See the attached file. I just checked more thouroughly; the bug occurs in Firefox and IE. Chrome and Safari seem to do just fine.
comment:4 Changed 4 years ago by dmethvin
- Component changed from unfilled to selector
It looks like the problem is in Sizzle's dirNodeCheck function. It assumes that once it finds a matching ancestor element it can stop looking, but actually I think it needs to continue up the tree to (in this case) find the ul under the body rather than just the inner ul.
comment:5 Changed 3 years ago by john
- Status changed from reopened to closed
- Resolution set to wontfix
Unfortunately it's not something that can be easily fixed. The selector would have to be broken into sub-parts and be re-queried as it goes up the tree. It would be both very expensive to run and would have a ton of overhead for most selectors. Unfortunately I think this is one case that we kind of have to punt on given the selector engine style that we choose :-/ Unfortunate, I know.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Is that your actual HTML? It's not well formed because it's missing closing tags. Can you put together a complete test case and attach it?