deleted --Karl
On Dec 28, 2009, at 3:19 PM, ajpiano wrote: > This page: > http://docs.jquery.com/Traversing/contains > needs to be removed from the docs. (Only a sysop can do this) > > It is not currently accessible from the main Traversing index, but it > still exists and someone came in yesterday wondering why this didn't > work in jQuery 1.3.2. > > FWIW, this is how i think .contains() should work, if it ever is > actually added back into the lib. > > On Dec 17, 5:26 pm, Karl Swedberg <k...@englishrules.com> wrote: >> I see. Yeah, that might work, except that Sizzle is currently very >> liberal about quotation marks: >> >> PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^ >> \2\ >> (\)]*)+)\2\))?/ >> >> I think it's a fairly common misconception that you have to use >> quotes >> within match[3], so at best it would take a lot of re-education and >> at >> worst it would break a lot of code. >> >> --Karl >> >> p.s. sorry about the tone of my last email. I just re-read what I >> wrote (the "how in the world" part, especially), and I think I >> sounded >> like an arrogant bastard. My apologies. >> >> On Dec 17, 2009, at 5:08 PM, Matt Maxwell wrote: >> >> >> >>> The text search would be surrounded by quotes, whereas searching by >>> an actual selector would not be in quotes, i.e. >>> $("div:contains(p)") would find all descendant p elements >>> $("div:contains('bar')") would find all divs containing the text >>> 'bar' >> >>> etc, etc >> >>> Though, John makes a good point. I guess the way I see it is, >>> jQuery already has a pretty intuitive design, and this sounded right >>> up its alley to me. >> >>> Just my idea. Obviously, if it doesn't fit the bill, don't go with >>> it. >> >>> On Thu, Dec 17, 2009 at 4:02 PM, Karl Swedberg >>> <k...@englishrules.com> wrote: >>> how in the world would jQuery know if you're trying to filter on the >>> text content "div" or on a descendant div element? >> >>> --Karl >> >>> On Dec 17, 2009, at 4:35 PM, Matt Maxwell 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- >>>>>>> d...@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 >>>>>> 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 >>>>> 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 >>>>> 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 >>>> 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 >>>> 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 >>> 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 >>> 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.