Ticket #4528 (closed bug: wontfix)
parent > child selector doesn't work as expected if the child tag is an id that isn't unique
| Reported by: | piev | Owned by: | john |
|---|---|---|---|
| Priority: | major | Milestone: | 1.4 |
| Component: | selector | Version: | 1.3.2 |
| Keywords: | parent, child, selector | Cc: | |
| Blocking: | Blocked by: |
Description
$('#id1 > #id2') does not return the existing object if its id ("id2") isn't unique.
Example:
<div id="test1">something goes here</div>
<div id="localHolding">
<div id="test1">Hello World</div>
<div id="test2">Hello Universe</div>
</div>
Then in the script section: $('#localHolding > #test1').length=0;
Note: Previous versions (1.2.6) did handle this as expected.
Attachments
Change History
Changed 4 years ago by piev
-
attachment
jquery_bug.htm
added
comment:1 Changed 3 years ago by ajpiano
This ticket should be marked as invalid. The id attribute is required to be unique.
comment:2 Changed 3 years ago by john
- Status changed from new to closed
- Resolution set to wontfix
This is going to have to be something that we'll punt on. In 1.2.6 #id1 > #id2 would fail if there were multiple #id1s, since in 1.3 we work right to left we just fail the other way around. We're going to have to pass on this, for performance reasons.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

html file illustrating unexpected behaviour (bug)