Skip to main content

Bug Tracker

Side navigation

#2590 closed bug (wontfix)

Opened March 26, 2008 06:29PM UTC

Closed March 27, 2008 04:52AM UTC

prev() doesn't work in IE

Reported by: telega Owned by:
Priority: major Milestone: 1.2.4
Component: core Version: 1.2.3
Keywords: Cc:
Blocked by: Blocking:
Description

Code $("ul").prev("li") doesn't work in IE. Opera & Firefox work as expected. Code below demostrates the error: "li" tags are not marked by red color in IE.

<script src="jquery-1.2.3.js"></script>

<ul>
  <li id="1">aaa</li>
  <li id="2">bbb</li>
  <ul>
    <li>ccc</li>
    <li>ddd</li>
  </ul>
  <li>eee</li>
  <ul>
    <li>ccc</li>
    <li>ddd</li>
  </ul>
</ul>

<script>
 $(document).ready(function() {
   $("ul").css("color", "blue").prev("li").css("color", "red");
 });
</script>
Attachments (0)
Change History (2)

Changed March 26, 2008 06:34PM UTC by telega comment:1

Tested in IE7.

Changed March 27, 2008 04:52AM UTC by davidserduke comment:2

resolution: → wontfix
status: newclosed

This appears to be a problem with IE and nested lists. When I debugged it I found IE thought the main UL only had 3 children (being the 3 LIs and not the nested ULs). I don't see how jQuery could realistically work around this browser bug. If you have some idea feel free to reopen the ticket with your thoughts.

Check the wiki to see that prev() is actually working in IE.

http://docs.jquery.com/Traversing/prev#expr