Skip to main content

Bug Tracker

Side navigation

#7334 closed bug (invalid)

Opened October 27, 2010 07:23PM UTC

Closed October 29, 2010 05:39AM UTC

children

Reported by: nefiga@hotmail.com Owned by: nefiga@hotmail.com
Priority: undecided Milestone: 1.5
Component: selector Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:
Description

The selector (* > *) behaves differently than

$().children().children()

I don't believe this is a duplicate of #7251 but I could be wrong. I've created a test case here: http://jsfiddle.net/z6XBx/10/

Attachments (0)
Change History (5)

Changed October 27, 2010 07:45PM UTC by rwaldron comment:1

component: unfiledselector
owner: → nefiga@hotmail.com
status: newpending

Can you reduce your test case to more clearly show the issue

Thanks!

Changed October 27, 2010 08:01PM UTC by nefiga@hotmail.com comment:2

status: pendingnew

I've simplified it somewhat, don't know how I can get much simpler than this.

http://jsfiddle.net/z6XBx/12/

Changed October 27, 2010 08:56PM UTC by jitter comment:3

_comment0: Further reduced the testcase \ \ http://www.jsfiddle.net/jitter/cgfAf/ \ \ I don't know if this is actually a bug. As `children( selector )` is supposed to return only immediate children off the elements in the jQuery object. \ \ I think jQuery is correct in returning nothing for `.children( 'ul > li' )` as no immediate child can satisfy this selector. \ \ Assume some `ul` is an immediate child of some element in the jQuery object. This selector basically tells jQuery to do the following. \ \ Give me all immediate children of the element in question which are of type `ul` and are at the same time of type `li` and an immediate child of an `ul` which is itself an immediate child of the element in question. \ \ This is contradictory.1288213023435317
_comment1: Further [http://www.jsfiddle.net/jitter/cgfAf/ reduced the testcase] \ \ \ I don't know if this is actually a bug. As `children( selector )` is supposed to return only immediate children off the elements in the jQuery object. \ \ I think jQuery is correct in returning nothing for `.children( 'ul > li' )` as no immediate child can satisfy this selector. \ \ Assume some `ul` is an immediate child of some element in the jQuery object. This selector basically tells jQuery to do the following. \ \ Give me all immediate children of the element in question which are of type `ul` and are at the same time of type `li` and an immediate child of an `ul` which is itself an immediate child of the element in question. \ \ This is contradictory.1288213224822923

Further reduced the testcase

I don't know if this is actually a bug. As children( selector ) is supposed to return only immediate children off the elements in the jQuery object.

I think jQuery is correct in returning nothing for .children( 'ul > li' ) as no immediate child can satisfy this selector.

Even if jQuery internally does find the li's which are children of ul's that are immediate children of the element in question, it shouldn't return them (or should it?) as these li's ain't immediate children of the element in question.


Assume some ul is an immediate child of some element in the jQuery object. This selector IMHO tells jQuery to do the following.

Give me all immediate children of the element in question which are of type ul and are at the same time of type li and an immediate child of an ul which is itself an immediate child of the element in question.

This is contradictory.

Changed October 27, 2010 09:47PM UTC by anonymous comment:4

Okay makes sense. Thanks for the explanation.

Changed October 29, 2010 05:39AM UTC by SlexAxton comment:5

resolution: → invalid
status: newclosed

Yes. Those two are not functionally equivalent, because the initial * matches every element in the dom, not just the top level.

Thanks for the report. Happy jQuery-ing!