Skip to main content

Bug Tracker

Side navigation

#4272 closed bug (invalid)

Opened March 01, 2009 12:45AM UTC

Closed November 04, 2009 02:49PM UTC

$('#id ~ div') doesn't work with divs

Reported by: sobi3ch Owned by: john
Priority: major Milestone: 1.4
Component: selector Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

so if you have

div id="x"

div class='test'

div class='test'

class test should be selected byt is not, i've checked with ver 1.2.6 and its fine

and if instedad of

div i will use e.g. span then everything is fine

Attachments (1)
  • jquery_test.html (0.3 KB) - added by davidserduke November 04, 2009 02:40PM UTC.
Change History (3)

Changed March 05, 2009 03:43AM UTC by dmethvin comment:1

owner: → john

Verified:

<div id="x"></div> <div class='test'></div> <div class='test'></div> 
alert($("#x ~ div").length)

Selects two elements in 1.2.6 but none in 1.3.2.

Changed October 14, 2009 12:58AM UTC by dmethvin comment:2

component: unfilledselector

Changed November 04, 2009 02:49PM UTC by davidserduke comment:3

resolution: → invalid
status: newclosed

This appears to be an invalid markup problem.

Assuming the test case meant this:

    <script type="text/javascript" src="../jquery.js"></script>
    <div id="x"></div> 
    <div class='test'></div> 
    <div class='test'></div>
    <script>alert($("#x ~ div").length);</script>

I tested in FF3.5 I saw the HTML generated by the test case put the ending script tag in the header. Of course then it wasn't waiting for the document to be ready which caused it to find no elements.

Closing on that basis but please reopen if you can find valid markup that causes this same behavior.