Ticket #6279 (closed bug: duplicate)
next adjacent selector and/or child selector in IE6
| Reported by: | timmywil | Owned by: | |
|---|---|---|---|
| Priority: | high | Milestone: | 1.next |
| Component: | selector | Version: | 1.4.2 |
| Keywords: | next adjacent selector ie6 ie7 | Cc: | |
| Blocking: | Blocked by: |
Description
I'm sorry I can't provide a test case. I need to leave the fixed version on our dev sites. But I can change the code back and forth. I'm sure it would be easy to create a test case. You can tell what the structure of my DOM is from the following code (glass-top is a select element, breed is an input element elsewhere on the page, and everything below is contained inside a div). Like so:
Markup: <div>
<select id="glass-top"/> <input/> <span/> <ul>
<li/>
</ul>
</div>
Original JS (works in all browsers except IE6): showHideBreed : function() {
$('#breed').hide(); $('#glass-top + input + span + ul > li').click(function() {
if($(this).attr('value') == 410) {
$('#breed').show();
} else {
$('#breed').hide();
}
});
}
Working JS: showHideBreed : function() {
$('#breed').hide(); $('#glass-top').next().next().next('ul').find('li').click(function() {
if($(this).attr('value') == 410) {
$('#breed').show();
} else {
$('#breed').hide();
}
});
}
I just thought you should know. It's possible that using the '+' selector multiple times in a row is causing problems in IE6? I'm not sure. I don't think the '>' child selector is the culprit because I tried replacing just that with find('li') and got the same result. I haven't looked at the jQuery source yet, but I thought I should go ahead and make the ticket.
Thanks guys, Timmy
Attachments
Change History
Changed 3 years ago by roydukkey
-
attachment
next-adjacent.htm
added
comment:1 Changed 3 years ago by roydukkey
I too have found this bug and can add some useful information. Attached is a test case.
It seems that in $("#btnAPI + ul li a") the next adjacent selector is failing in ie6 and ie7. However, if you try to select the element via the next() and find() functions, all is well. ie. $("#btnAPI").next("ul").find("li a").
The next adjacent selection was working in version 1.3.2.
comment:4 Changed 3 years ago by snover
- Priority set to high
- Status changed from new to open
test case also problematic in ie7, so a problem with Sizzle.
comment:5 Changed 2 years ago by danheberden
- Milestone set to 1.next
Still present in ie6 and ie7 in 1.5.2pre
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Next Adjacent Selector Fails IE6 and IE7