Skip to main content

Bug Tracker

Side navigation

#7237 closed bug (worksforme)

Opened October 18, 2010 12:00PM UTC

Closed October 18, 2010 04:32PM UTC

Last modified March 15, 2012 12:15PM UTC

next() skips sibling in nested ul element in IE8

Reported by: m.hawkes@hallandpartners.com 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.

Attachments (0)
Change History (2)

Changed October 18, 2010 02:06PM UTC by jitter comment:1

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

Changed October 18, 2010 04:32PM UTC by addyosmani comment:2

component: unfiledevent
keywords: → next IE sibling nested
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.