[jQuery] .next() bug?
[jQuery] .next() bug?
The mark-up:
<ul>
<li></li>
<li class="expandable"></li>
<ul>
<li></li>
<li></li>
</ul>
</li>
<li></li>
</ul>
The js:
$('li.expandable')
.bind('click', function(){ $(this).next().slideToggle('fast'); })
.next().hide()
;
Now, my mark-up is wrong. I should have wrapped the nested <ul> in it's own
<li>, but I missed it. Testing looked good in FF 2, .next() was returning
the nested <ul>, and I didn't even notice the problem. In IE6/7 however,
.next() returned the next <li>, and not the <ul> which was in fact next the
next element. Wrapping the <ul> in it's own <li></li> as it should be
solved the discrepancy, but the fact that there is a discrepancy in how the
two browsers interpret .next() makes me think perhaps there's a bug in
there.
My understanding of sibling was the next element in line on the same level,
but in the case of the mark-up above IE seems to interpret the next sibling
as the next element in line on the same level and of the same type. Am I
wrong in my understanding of sibling?
Adam
--
View this message in context: http://www.nabble.com/.next%28%29-bug--tf3309804.html#a9206703
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/