3 ms·
On the server side (Helma/Rhino) I do a lot of functional-style JavaScript anyway, so jQuery feels very natural to me. It does have a lot of sugar, but playing
by midnightmonster 18y ago
On the server side (Helma/Rhino) I do a lot of functional-style JavaScript anyway, so jQuery feels very natural to me. It does have a lot of sugar, but playing with the DOM needs it. Crockford described the DOM as having been written by people who like Java[-esque things] and hold JavaScript and its style in contempt. I can't speak to the history, but the actual W3C DOM standards are such that that could certainly be true. The W3C DOM is not plain old JS. The W3C DOM is a verbose, clumsy API direct-ported from (essentially) Java into JavaScript.
> then it becomes so habitual that you forget how to write "regular" javascript.
I wish that were true. Unfortunately, I still have to drop back to W3C DOM for performance often enough. For a recent feature I added, 6 lines of jQuery becomes 24 lines of JavaScript, but the speed goes from unacceptable to acceptable. (What am I doing that jQuery's not fast enough? In this case keystroke-by-keystroke search and manipulation of a 6000-cell table.)
- twism 18y agohey, I'm looking for people who are interested in server side javascript and jquery to help give some input on a framework I'm working on. The framework is about a month old but the core concept is already there. if you or anyone is interested send me a email (tunde.ashafa AT gmail)
- nostrademons 18y ago> 6 lines of jQuery becomes 24 lines of JavaScript, but the speed goes from unacceptable to acceptable Have you tried JQuery 1.2.6 yet? I've also had to drop down to raw DOM for performance, but I've found that many features that were unacceptably slow with 1.2.3 (mousemove events, $.map) have gotten quite usable. Events no longer copy the whole event object, map is linear time instead of quadratic, and I've heard $.extend got a major speed boost which'll speed up construction of all jQuery objects.
- Xichekolas 18y agoMap was quadratic before?! It seems like it would take deliberate effort to make it anything other than linear.
- nostrademons 18y ago$.map has an interesting quirk in its spec: it flattens returned arrays into the result. This was implemented by calling concat() with each result, but concat creates a new array for its return value. So each iteration was creating a new array and copying over the previous values, which makes for a quadratic runtime in most JS runtimes. (Curiously, in the benchmarks folks did in the Reddit thread, it looked like Firefox was not quadratic - which implies that Firefox either has some clever optimizations going on or does crazy things with concat().)