Bug Tracker

Modify

Ticket #7237 (closed bug: worksforme)

Opened 3 years ago

Last modified 14 months ago

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:
Blocking: Blocked by:

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

comment:1 Changed 3 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 3 years ago by addyosmani

  • Keywords next IE sibling nested added
  • Priority changed from undecided to low
  • Status changed from new to closed
  • Component changed from unfiled to event
  • Resolution set to worksforme

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.