Side navigation
#4520 closed bug (invalid)
Opened April 11, 2009 03:20PM UTC
Closed May 10, 2009 03:13AM UTC
Last modified March 15, 2012 02:33PM UTC
Parent > child selector does not works as espected!
Reported by: | andreabalducci | Owned by: | john |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | selector | Version: | 1.3.2 |
Keywords: | selectors | Cc: | |
Blocked by: | Blocking: |
Description
Using jquery-1.3.2-vsdoc2.js i found that the parent > child selector is selecting childs outside the parent.
With the .min and the standard .js all works fine.
try this:
<html>
<head>
<title> test </title>
<style>
#container > span{ color: navy; font-size:xx-large;}
</style>
<script type="text/javascript" src="jquery-1.3.2-vsdoc2.js"></script>
<script type="text/javascript">
$(function(){
$('#container > span').css('background-color', 'gray');
});
</script>
</head>
<body>
<div id="container">
<span>gray background</span>
</div>
<span>transparent background</span>
</body>
</html>
Attachments (0)
Change History (4)
Changed April 11, 2009 03:56PM UTC by comment:1
Changed April 13, 2009 11:52AM UTC by comment:2
i downloaded all the js from the google repo.
Changed April 13, 2009 11:58AM UTC by comment:3
Replying to [comment:1 dmethvin]:
Where did you get that copy of jQuery?
http://jqueryjs.googlecode.com/files/jquery-1.3.2-vsdoc2.js
Here the test with QUnit
<html>
<head>
<title> test </title>
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2-vsdoc2.js"></script>
<link rel="stylesheet" href="http://dev.jquery.com/view/trunk/qunit/testsuite.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://jqueryjs.googlecode.com/svn/trunk/qunit/testrunner.js"></script>
<script type="text/javascript">
$(function(){
test("inside span", function() {
expect(2);
var list = $('#container > span');
equals( list.length, 1, "span count inside the div = 1" );
equals( list[0].innerHTML, 'Inside div', "innerHTML of inside span" );
});
test("outside span", function() {
expect(2);
var list = $('span').not('#container > span');
equals( list.length, 1, "span count outside the div = 1" );
equals( list[0].innerHTML, 'Outside div', "innerHTML of outside span" );
});
test("all span", function() {
var list = $('span');
equals( list.length, 2, "all span count = 2" );
});
});
</script>
</head>
<body>
<div id="container">
<span>Inside div</span>
</div>
<span>Outside div</span>
<div id ="test_results">
<h1>QUnit example</h1>
<h2 id="banner"></h2>
<h2 id="userAgent"></h2>
<ol id="tests"></ol>
<div id="main"></div>
</div>
</body>
</html>
Changed May 10, 2009 03:13AM UTC by comment:4
resolution: | → invalid |
---|---|
status: | new → closed |
The vsdoc version of jQuery is meant only for Intellisense in Visual Studio, it shouldn't be used at runtime or in web pages.
Where did you get that copy of jQuery?