Skip to main content

Bug Tracker

Side navigation

#11031 closed feature (invalid)

Opened December 15, 2011 11:23AM UTC

Closed January 11, 2012 04:33PM UTC

.children() multiple hierarchy levels

Reported by: tsukasa1989 Owned by: tsukasa1989
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:
Description

Currently working on a project and since I do know the exact structure and I want a good performance I am using the following code (this is faster then .find()):

$("#moduleConatainer").children("table").children("tbody").children("tr");

The code functions, but it would be better if something like this is possible, which currently returns 0 elements:

$("#moduleConatainer").children("table tbody tr")
Attachments (0)
Change History (3)

Changed December 15, 2011 01:38PM UTC by dmethvin comment:1

owner: → tsukasa1989
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

Changed December 15, 2011 02:59PM UTC by tsukasa1989 comment:2

status: pendingnew

I have a fiddle here: http://jsfiddle.net/FrKyN/163/

Running this code:

console.log("children('div').children('label') length: " + $("#container").children("div").children("label").length);

console.log("children('div label') length: " + $("#container").children("div label").length);

On this HTML:

<div id="container">
    <div>
        <label></label>
    </div>
</div>

Result:

children('div').children('label') length: 1
children('div label') length: 0

Changed January 11, 2012 04:33PM UTC by dmethvin comment:3

_comment0: http://jsfiddle.net/FrKyN/208/ \ \ Read the selector from right to left. You're selecting inputs below #container and there are none. Followups to http://forum.jquery.com. \ 1326299619126667
resolution: → invalid
status: newclosed

http://jsfiddle.net/FrKyN/208/

Read the selector from right to left. You're selecting labels below #container and there are none. Followups to http://forum.jquery.com.