Bug Tracker

Modify

Ticket #7906 (closed bug: fixed)

Opened 3 years ago

Last modified 2 years ago

eq() selector not working in 1.4.4 with previous adjacent selectors

Reported by: paul.johnston@… Owned by:
Priority: low Milestone: 1.5
Component: selector Version: 1.4.4
Keywords: Cc:
Blocking: Blocked by:

Description

In 1.4.2, the following selector produces a set of one element: $(".previous + .next p:eq(0)")

However, in 1.4.4 the set is empty.

A simple page to demonstrate the problem is given below.

<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns=" http://www.w3.org/1999/xhtml" > <head runat="server">

<title></title> <script type="text/javascript" src=" https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>

<!-- 1.4.2

<script type="text/javascript" src=" https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

-->

</head> <body>

<div>

<div class="previous">

</div> <div class="next">

<p>This is the first text block</p> <p>This is the second text block</p>

</div>

</div>

<script type="text/javascript">

$(function() {

$(".previous + .next p:eq(0)").css("color", "red");

});

</script>

</body> </html>

Change History

comment:1 Changed 3 years ago by ajpiano

  • Status changed from new to closed
  • Resolution set to fixed

While the  bug reporting guidelines mandate that you provide a testcase in jsFiddle, I went ahead and made one in the interest of figuring out if this was a legit issue.

The bad news? It was indeed a bug in 1.4.3 and 1.4.4, and the selector worked in 1.3.2 and 1.2.6, etc. The good news? It's fixed in the latest revision (GIT 0)  http://jsfiddle.net/ajpiano/3zRPY/ !

comment:2 Changed 3 years ago by jitter

  • Priority changed from undecided to low
  • Component changed from unfiled to selector
  • Milestone changed from 1.next to 1.5

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.