Bug Tracker

Ticket #3887: jquery-1.3-adjacent.html

File jquery-1.3-adjacent.html, 1.2 KB (added by dalangalma, 14 years ago)

Repro for next selector bug

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html>
3        <head>
4                <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
5                <title>jQuery 1.3 Adjacent Selector Bug</title>
6    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
7    <script type="text/javascript">
8      $(function() {
9        $('span.foo + a').css('background', 'green');
10      });   
11    </script>
12        </head>
13        <body>
14          <h1>jQuery 1.3 Adjacent Selector Bug</h1>
15    <ul>
16      <li><a href="#">Link</a> <span>Regular Span</span> <a href="#">Link</a></li>
17           
18      <li><span>Regular Span</span> <a href="#">Link</a></li>
19      <li><span>Regular Span</span> <a href="#">Link</a></li>
20      <li><span>Regular Span</span> <a href="#">Link</a></li>
21    </ul>
22   
23    <p>This test runs <tt>$('span.foo + a').css('background', 'green');</tt>, which should turn none of the links
24    green, since none of the spans have a class. In jQuery 1.3 (Sizzle v0.9.1) it highlights all the links that
25    appear after a span, but only once a span is proceeded by a link!</p>
26   
27    <p><a href="./">Back to Browser Bugs</a></p>
28        </body>
29</html>