#4243 closed bug (fixed)
Selector ~ failed
Reported by: | kanzi | Owned by: | john |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | selector | Version: | 1.4a1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
$("#prev ~ div").css("border", "3px groove blue"); on "http://docs.jquery.com/Selectors/siblings#prevsiblings"
the border of div matched is not blue.
$("#prev ~ div").html() return null.
Change History (6)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
Repost from http://groups.google.com/group/jquery-dev/browse_thread/thread/aa580809104fce79
sample markup
<html> <head> <!-- 1.3.2. looks like broken --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <!-- Nightly. works --> <!-- <script type="text/javascript" src="http://code.jquery.com/nightlies/jquery-nightly.js"></script> --><!-- 1.3.1. works --><!-- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script> --> <script type="text/javascript"> $(document).ready(function(){ console.log($('#prev ~ div').length);/*expecting 1, got zero in 1.3.2*/ }); </script> </head> <body> <div id="prev">1</div> <div>2</div> </body> </html>
proposed fix (by Fabio Buffoni), works for me:
If you need a quick fix, removing the if
if ( sibDir && elem.nodeType === 1 ) { ... }
in dirNode and dirNodeCheck should fix the problem
hope it helps
comment:3 Changed 13 years ago by
Component: | unfilled → selector |
---|---|
Owner: | set to john |
comment:5 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Version: | 1.3.2 → 1.4a1 |
This appears to be fixed. http://github.com/jeresig/sizzle/commit/ecd57af1b7562dae6f3bddb9b02477f23076e6bb
comment:6 Changed 13 years ago by
Note: See
TracTickets for help on using
tickets.
This example is contained on the iframe, so it's OK.
$('#prev~div', $('iframe')[0].contentDocument) works OK there.
But $('#prev~span', $('iframe')[0].contentDocument) doesn't. It's the real bug.