Skip to main content

Bug Tracker

Side navigation

#7906 closed bug (fixed)

Opened January 06, 2011 12:43AM UTC

Closed January 06, 2011 06:36AM UTC

Last modified March 14, 2012 12:20AM UTC

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

Reported by: paul.johnston@aec.gov.au 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>

Attachments (0)
Change History (2)

Changed January 06, 2011 06:36AM UTC by ajpiano comment:1

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/ !

Changed January 07, 2011 03:57PM UTC by jitter comment:2

component: unfiledselector
milestone: 1.next1.5
priority: undecidedlow