> ok, so next time i want to code something in jquery i'll just write > $(make coffee) ? Haha, now I'm questioning your ambition. This is the holy grail of all programming, it's almost blasphemy to make fun of it ; ). > For me (and I really mean not speaking for everyone) it's more > intuitive if there is an internal logic that I can understand; Ok, I guess in this case the only "language" we share is jQuery ; ). Intuition irrational by definition, see: http://www.google.com/search?q=define:intuition. > No, there are things that are intuitive **once you've understood the > basics**. IOW intuitiveness is based on your assumptions and your > knowledge. Why would you assume that .hasClass() exists? And not, > e.g., isMemberOf() or .classMatches() ? It must depend of what you're > already familiar with before you switch to jQuery. I agree with you that people will try to use stuff they know from other libraries first before falling back to intuition. So what would be two of the most popular ones to expect?
Mootools: * includes a hasClass() function: http://docs.mootools.net/Native/Element.js#Element.hasClass * includes a remove() function: http://docs.mootools.net/Native/Element.js#Element.remove Prototype: * includes a hasClassName() function: http://www.prototypejs.org/api/element#method-hasclassname * includes a remove() function: http://www.prototypejs.org/api/element/remove To be fair. Neither Mootools nor Prototype seem to include an exists() function. This however could also be traced back by the fact that they do not share the jQuery philosophy in terms of advocating their CSS selector engine as a) their main element retrieval method and b) don't use it as a wrapper for chainability. Anyway I can see your argument about how an exists() function would be redundant. jQuery has a lot of convenience wrappers for things, but $.fn.exists = function(){return !!this.length}; would be the smallest and least functional one. Same is almost true for hasClass (return this.is('.'+class));. This is where you can convince me with a rational/scientific argument that those functions aren't needed. However, as you said this library is more then just code, it's art. And this is why I'm emphasizing those new functions: They empower the artist (who does not read the complete docs before getting started) and don't hurt the scientists .... What a rant ... haha Anyway, interesting discussion and good arguments, -- Felix -------------------------- My Blog: http://www.thinkingphp.org My Business: http://www.fg-webdesign.de Fil wrote: > >> jQuery is a language >>> It was a library last time I checked ; ). > > yeah, well, it can be many things to many people; we all agree it's > code. I think it's art, too > >> Why? For me the sweetest thing about using jQuery has been it's >> intuitiveness right out of the box. > > ok, so next time i want to code something in jquery i'll just write > $(make coffee) ? > > No, there are things that are intuitive **once you've understood the > basics**. IOW intuitiveness is based on your assumptions and your > knowledge. Why would you assume that .hasClass() exists? And not, > e.g., isMemberOf() or .classMatches() ? It must depend of what you're > already familiar with before you switch to jQuery. > > For me (and I really mean not speaking for everyone) it's more > intuitive if there is an internal logic that I can understand; adding > stuff that is redundant is merely adding cruft, and hence > counter-intuitive. > > That's why I wanted to add my "I don't agree" message -- though I > understand and respect your position, I don't share it. > > -- Fil >