Hey Dan,

Yeah, it's also strange that while this doesn't work:
         $("body > ul > li").filter($li[0]);

this does:
        $("body > ul > li").not($li[0]);

I'm a little lost by your parents example, though. Not sure exactly what you're trying to get (esp. since you don't show where you've declared $el and $parent.

couldn't you do something like
$el.parent() ?
or $el.parent('.someclass') ?
or $el.parents('.someclass:first') ?

(just using class in the parents filter because not sure what you're after).



--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On May 7, 2008, at 9:06 AM, Dan G. Switzer, II wrote:


Just wonder if there were any comments to this?

On May 5, 4:24 pm, "Dan G. Switzer, II" <[EMAIL PROTECTED]>
wrote:
One thing that I've noticed is that the "expr" attribute is pretty
inconsistent across methods (such as filter, find, parents, parent, etc.) The documentation is very vague about what an "expression" is, other than it just being a selector. However I would assume a valid expression for one element would be valid for all elements, but I've noticed that an HTML
element is only a valid expression in the find() method.

For example:

$li = $("li");

// returns the first matches for $li
$("body > ul > li").find($li[0]);

// this actually errors with a "t.substring is not a function" error
$("body > ul > li").filter($li[0]);

// I would expect this to only return the element which is the first $li, // but instead it ignores the expression altogether and returns all parents
$("li[rel=45]").parents($li[0]);

Shouldn't "expressions" work the same across all methods?

Right now I'm having to use this to find only the explicit parent:

$el.parents().filter(function (){ return this === $parent[0]; });

However, if parents() worked like find() I would be able to do:

$el.parents($parent[0]);

(Before you say "Why not just use $parent?", it's because I'm checking to
see if an element is a child of a specific element.)

-Dan

Reply via email to