On 12/14/06, Dave Methvin <[EMAIL PROTECTED]> wrote:
> Would this be a candidate for addition to the core possibly?
The ancestorsTo looks like it's an up-the-tree analog of the nextUntil
method for siblings that was discussed here a while back. I think the
general consensus on that was that there would be an extended navigation
plugin rather than add all these to the core. Maybe they should be named
ancestorsUntil and siblingsUntil for better consistency?
That makes quite a bit of sense. Has anyone undertaken this plugin? I wasn't
able to find it in SVN under plugins.
Also, since this is a modifying plugin it should use pushStack() to allow
the use of .end() to get back to the previous selected nodes. I think the
end result would be something like this, untested:
jQuery.fn.ancestorsUntil = function(match) {
var a = [];
jQuery(this[0]).ancestors().each(function() {
a.push(this);
return !jQuery(this).is(match);
});
return this.pushStack(a, arguments);
};
Ah, that's beautiful! (tested it locally and it works as intenteded)
Cheers,
-js
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/