Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#7906 closed bug (fixed)

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

Reported by: [email protected] Owned by:
Priority: low Milestone: 1.5
Component: selector Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

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 (2)

comment:1 Changed 12 years ago by ajpiano

Resolution: fixed
Status: newclosed

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 12 years ago by jitter

Component: unfiledselector
Milestone: 1.next1.5
Priority: undecidedlow
Note: See TracTickets for help on using tickets.