Side navigation
#4243 closed bug (fixed)
Opened February 25, 2009 10:28AM UTC
Closed December 08, 2009 06:25PM UTC
Last modified December 20, 2009 05:29PM UTC
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.
Attachments (0)
Change History (6)
Changed March 11, 2009 02:48PM UTC by comment:1
Changed March 13, 2009 03:14AM UTC by comment:2
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
Changed October 08, 2009 05:31AM UTC by comment:3
Changed December 08, 2009 06:25PM UTC by comment:5
resolution: | → fixed |
---|---|
status: | new → closed |
version: | 1.3.2 → 1.4a1 |
This appears to be fixed.
http://github.com/jeresig/sizzle/commit/ecd57af1b7562dae6f3bddb9b02477f23076e6bb
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.