Skip to main content

Bug Tracker

Side navigation

#3657 closed feature (invalid)

Opened November 27, 2008 01:43PM UTC

Closed November 27, 2008 01:50PM UTC

New feature: selfOrParents traversal function

Reported by: jollytoad Owned by:
Priority: minor Milestone: 1.3
Component: core Version: 1.2.6
Keywords: Cc: jollytoad
Blocked by: Blocking:
Description

I find it handy to be able to traverse using parents, but include the current context in the search, like the XPath ancestors-or-self axis.

It's very handy for this kind of thing:

if (!$(...).selfOrParents(':hidden').length) {

// do something because we are visible

}

rather than having to do:

var tmp = $(...);

if (!(tmp.is(':hidden') || tmp.parents(':hidden').length)) { ... }

I've attached a patch, it's very small :)

Attachments (1)
Change History (1)

Changed November 27, 2008 01:50PM UTC by flesler comment:1

cc: → jollytoad
resolution: → invalid
status: newclosed

If I'm not wrong, that can be achieved with:

$(...).parents().andSelf().is(':hidden')

That seems to me like pretty much the same amount of code.

So.. I think this is not really useful, generally speaking.