i just want direct children
Does anyone know why the default behavior of jQuery is to select ALL the child elements down the entire tree from the parent?
Something like $('body > center') will locate all the center elements on the entire page, not just the center elements that are direct children of the parent.
This seems to me like a major design flaw. 95% of the time when looking for children you want the direct children of the parent, so why wasn't this made the default?
Supposedly .children() only selects direct children, but that doesn't always work either... like this:
$('center').children('*:contains("Search text")')
This returns an array of 2 elements, not the single center that has a text node child containing the search text.
It seems so backwards that it trips me up just about every single time I need to select something, and I always wind up having to go as far down the tree as possible to find something unique, then backtracking with a bunch of parent() chains just to find, say, the table element I'm looking for.