There's no place in jQuery where we accept a selector of a string of text. There are places where we accept a selector or an HTML string - but that's another matter entirely.
--John On Thu, Dec 17, 2009 at 4:35 PM, Matt Maxwell <leftwithoutli...@gmail.com> wrote: > It's a selector or a string of text. jQuery already contains the ability to > intuitively decipher its selectors. > For example, filter can contain an expression or a function. These are two > completely different things as well. > > On Thu, Dec 17, 2009 at 3:13 PM, Karl Swedberg <k...@englishrules.com> > wrote: >> >> But :has() and :contains() do two completely different things. :contains() >> filters based on text contents while :has() filters based on selectors. So, >> I think it would be a really bad idea to try to combine them. >> >> --Karl >> >> On Dec 17, 2009, at 3:48 PM, Matt Maxwell wrote: >> >> I think .has() should return a bool, :has() should be combined with >> :contains() (the finished filter named :contains()), and .contains() should >> go away. >> That seems to make the most sense to me, anyways. >> On Thu, Dec 17, 2009 at 9:20 AM, Karl Swedberg <k...@englishrules.com> >> wrote: >>> >>> On Dec 16, 2009, at 11:14 PM, John Resig 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 >>> >>> But if .has() returns a boolean, then we have the same problem with >>> :has() vs. .has() as we had with :contains() vs. contains(). >>> Since :has() is a filter, I would expect .has() to be a filter. >>> On Dec 17, 2009, at 12:45 AM, Rick Waldron wrote: >>> >>> John, I tend to assume that anything prefixed with 'is' or 'has' will >>> return a boolean. I think this is likely a common assumption. >>> >>> I typically assume the same thing, but in this case .has() is not a >>> prefix; it's the full method name. And we already have the pseudo-selector >>> :has() that acts as a filter. >>> >>> --Karl >>> >>> 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 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. >>> >>> >>> >>> >>> -- >>> >>> 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. >> >> -- >> >> 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. > -- 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.