Ticket #9391 (closed feature: wontfix)
|Reported by:||onerob@…||Owned by:|
Description (last modified by scott.gonzalez) (diff)
I'd like to see what I'd call a 'depth' selector or filter. This would let me find an element(s), matching a selector, that was specifically the nth nested level of that element down from the current location (in fact, it would be very handy to be able to traverse both up and down the DOM).
This would be useful when working with sites that output code that contains a great deal of nesting of divs, ULs or tables. As an example, here's something of the flavour of what I'm after:
$('table.someClass > td:depth(3)')
which would be easier than...
$('table.someClass > tbody > tr > td > table > tbody > tr > td > div > table > tbody > tr > td)')
If you wanted to select all TDs that were 3 levels down and any other descendant TDs, you would simply write:
$('table#someClass > td:depth(2) td')
I suppose the downside is that people might use it out of laziness when it may be far more optimal to write code that was just a little longer.
Thanks for reading.
- Priority changed from undecided to low
- Component changed from unfiled to selector
- Description modified (diff)