Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: "Christoph M. Becker" Newsgroups: comp.lang.javascript Subject: Re: jquery and hoi polloi Date: Thu, 11 Dec 2014 03:16:22 +0100 Organization: solani.org Lines: 41 Message-ID: References: <3e25f0fa-4c3f-4d51-a6a0-da69bd8b3677@googlegroups.com> <27938323-9eca-480c-8ead-2000865bcecc@googlegroups.com> <82684c28-b567-4b2c-8d2b-eb0c41376cd2@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: solani.org 1418264174 15253 eJwFwQkBACAIA8BKTHnjKLj+Ebyz7fAOdXM1GvtsZ1bMoV4oUVeegxmclQREFauHLwTV9gEnhhE1 (11 Dec 2014 02:16:14 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Thu, 11 Dec 2014 02:16:14 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 X-User-ID: eJwFwYEBgDAIA7CXBNaC5wgr/59ggqBx8hA8WGzE5lVTXih479r1YU+wvN+jbs2nB2TSpB8sQBHL In-Reply-To: <82684c28-b567-4b2c-8d2b-eb0c41376cd2@googlegroups.com> Cancel-Lock: sha1:QRvFvrplgH5DigdcXeTAXYWsCec= X-NNTP-Posting-Host: eJwNwgERwDAIA0BLsATSyhkr+JfQ3X8gPT8xIxkT07JXa0rYuziNn+TwzUdmZ6Hcm1bOg2pcFG0QnQ== Xref: csiph.com comp.lang.javascript:26309 RobG wrote: > Yes, jQuery isn't so bad for performance if used judiciously. However, there are some cases where the perfomance of jQuery is really bad. These cases might not be relevant for the overall performance, but nonetheless I won't call avoiding them micro-optimizations. See for instance . What's wrong with using document.getElementById()? > However, because many who use it have no idea what it's doing, they > don't understand the performance risk until it becomes an issue. > Often it's the result of using selectors based on complex DOM > structures, fixing that later means virtually re-writing the > application. From my limited experience, not seldom it's just the matter of repeating yourself. Apparently, jQuery enforces this technique. For instance: $(".foo .bar .baz").do_something(); // ... $(".foo .bar .baz").do_something_else(); instead of: var elems = $(".foo .bar .baz"); elems.do_something(); // ... elems.do_something_else(); (I'm aware that the two snippets are not necessarily equivalent, but too often they are.) > Also, the mantra of "do more with less" doesn't necessarily deliver. > Many seem to think that if they use jQuery, the equivalent POJS must > be more code when likely it isn't. "POJS"? Plain old JavaScript? -- Christoph M. Becker