John, I tend to assume that anything prefixed with 'is' or 'has' will return a 
boolean. I think this is likely a common assumption.

Rick

-- Sent from my Palm Prē
ajpiano wrote:

I meant people are used to using $(foo).anyfiltermethod().length.

Glad to see .contains() is gone until it can be all it can be. As it

was, .contains was just a shortcut to .is(":has(foo)")





On Dec 16, 11:14 pm, John Resig <jere...@gmail.com> wrote:

> People are use to using .has()? It was only just added - at the same

> time as .contains() as well.

>

> I'll mull over the .contains() discrepancy. I may just punt it and

> push people towards .has() anyway.

>

> Looking at .has() now I'm not 100% sure why it's filtering and not

> just returning a boolean, like .is(). Hmm. If .has() returns a boolean

> then yeah, consider .contains() gone (and a jQuery.contains will be

> provided for those that need a lightweight method).

>

> --John

>

>

>

> On Wed, Dec 16, 2009 at 11:04 PM, ajpiano <ajpi...@gmail.com> wrote:

> > It seems like a matter of course that means of filtering that are

> > exposed as both pseudoselectors and methods on the jQuery prototype

> > return the same set of elements, or at least that they generally apply

> > the same principle in filtering.  Examples include eq, not, first,

> > last, and has.  While the :parent pseduo doesn't work the same

> > as .parent(), most developers know what they're looking for if they're

> > using :parent.

>

> > The new $.fn.contains method, however, doesn't work like :contains.

> > Rather than searching for the text content of elements, .contains() is

> > just a shortcut to $(elem).has("foo").length > 0.  I'm not sure why

> > this is really a necessary shortcut, given that most people are plenty

> > used to doing something like .has().length anyway.  I tend to think,

> > however, that .contains () should work like :contains, for

> > consistency's sake.

>

> > This would have the added benefit of allowing those people who do

> > use :contains to write code like this:

>

> > var foo = "barbazbat";

> > $("div").contains(foo);

>

> > instead of

> > $("div:contains("+foo+")");

>

> > Anyone else have any thoughts on this?

>

> > --adam

>

> > --

>

> > You received this message because you are subscribed to the Google Groups 
> > "jQuery Development" group.

> > To post to this group, send email to jquery-...@googlegroups.com.

> > To unsubscribe from this group, send email to 
> > jquery-dev+unsubscr...@googlegroups.com.

> > For more options, visit this group 
> > athttp://groups.google.com/group/jquery-dev?hl=en.



--



You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.

To post to this group, send email to jquery-...@googlegroups.com.

To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com.

For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en.






--

You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en.


Reply via email to