Bug Tracker

Modify

Ticket #4520 (closed bug: invalid)

Opened 4 years ago

Last modified 14 months ago

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:
Blocking: Blocked by:

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>

Change History

comment:1 follow-up: ↓ 3 Changed 4 years ago by dmethvin

Where did you get that copy of jQuery?

comment:2 Changed 4 years ago by andreabalducci

i downloaded all the js from the google repo.

comment:3 in reply to: ↑ 1 Changed 4 years ago by andreabalducci

Replying to 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>

comment:4 Changed 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

The vsdoc version of jQuery is meant only for Intellisense in Visual Studio, it shouldn't be used at runtime or in web pages.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.