Bug Tracker

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#7237 closed bug (worksforme)

next() skips sibling in nested ul element in IE8

Reported by: m.hawkes@… Owned by:
Priority: low Milestone: 1.5
Component: event Version: 1.4.3
Keywords: next IE sibling nested Cc:
Blocked by: Blocking:

Description

I'm using Windows XP SP3, IE 8.0.6001.18702 and jQuery 1.4.3. Problem is, next() misses the next sibling in a nested list in IE8. (In Firefox 3.6 it runs fine.) See a demo

My HTML is:

  <ul>
    <li>Toolkit</li>
    <ul>
      <li>t1</li>
      <li>t2</li>
    </ul>
    <li>Digital</li>
    <ul>
      <li>d1</li>
      <li>d2</li>
    </ul>
  </ul>

My jQuery is:

  // I expect "t1\nt2"
  alert( jQuery("li:first").next().text() );

Firefox alerts "t1\nt2". IE8 alerts "Digital d1 d2". I regard Firefox's behavior as correct. I regard IE8 as broken.

Change History (2)

comment:1 Changed 9 years ago by jitter

Your html markup is invalid which could be the cause for the different behavior. You can't have ul as direct child of another ul. You need to wrap them in an li. e.g.

<li>Toolkit
<ul><li>t1</li><li>t2</li></ul>
</li>

But actually I can't reproduce your problem neither with valid nor invalid html structure in IE8 (8.0.6001.18702)

See this live test case in both alerts IE8 returns t1t2

comment:2 Changed 9 years ago by addyosmani

Component: unfiledevent
Keywords: next IE sibling nested added
Priority: undecidedlow
Resolution: worksforme
Status: newclosed

As per Jitter, this is working fine for me too. We're going to close this ticket for now but if you're able to supply additional test cases that reproduce the behavior cited, we'll be more than happy to reopen and reinvestigate.

Note: See TracTickets for help on using tickets.