JQuery 1.4.2 Released
blog.jquery.com
blog.jquery.com
Basically, it is awesome that performance has doubled again, but how far away are we from native browser performance in modern browsers?
That being said there were two areas in which there was genuine improvement made that will affect your code:
* Continuing to improve the speed of remove/empty/html. These methods are heavily used so anything done here will improve your code, absolutely.
* Improving speed of inserting a single DOM node. This was an interesting case. In jQuery core we use DOM fragments to hold and insert DOM nodes. It's faster for when you have multiple DOM nodes to insert - but actually slightly slower if you only have one to insert. In that case we just route around it and insert the node directly (this sped of WebKit, for example).
Those are the changes that I'm most pleased with, for sure. It's easy to gauge the difference between jQuery and native performance in absolute terms (time in milliseconds) but at some point we simply won't be able to get any faster - the overhead will be a couple function calls and some if/else statements (which is effectively what's happened to a few jQuery methods). So yeah, I'm not sure how far away we are but I will absolutely keep working towards that getting us closer to that ideal.
Woah, woah - what's this? We had a bug relating to the improved change event in jQuery 1.4 which was fixed in 1.4.1 (one week later) and improved in 1.4.2 (two weeks later).
IE's change event model is highly broken - both in the sense that it doesn't bubble but also that it doesn't work correctly when compared to the implementation of other browsers. We override that so that it's actually fixed and unified across all browsers.
I definitely disagree that we "make breaking changes too often" - there was approximately 11 months inbetween jQuery 1.3.2 and 1.4 - that's a significant amount of time and even when we did make changes we fixed bugs rapidly and responsively.
If there are any un-fixed bugs please let me know (especially if you've filed it in the bug tracker) and I'll happily work to resolve them.
But that isn't really the point. While I commend you for trying to provide a cross-browser portable event model, the fact is that the changes in 1.4 got it wrong. If that had only affected jQuery itself, it wouldn't have been so bad, we could simply not have used the affected features until they were working properly. But it didn't just affect jQuery, it broke handling of change events for controls like checkboxes fundamentally in IE, so that well-established workarounds like the old "onclick='blur()'" trick were no longer effective either.
That particular bug took us several hours to pin down after we moved to 1.4, and ultimately our only solution was to back out the change and go back to the 1.3 series until the fix.
There was a similar situation in the upgrade from 1.3.1 to 1.3.2: what sounds like a minor bug-fix type release actually changed the way visibility was tested significantly, which caused problems for an occasional colleague of mine who was working with nested potentially-hidden views (i.e., one of a set of outer containers would be visible, and within that there were things like tab/accordion structures where some of the information would also be hidden). Again, while I don't doubt that the change was made with good intent and obviously the performance of the newer approach is much better, it pulled the rug out from under an existing project, and forced the people maintaining it to stop and go back over previously working code so that it would continue working with the new jQuery.
As I said, I've been using jQuery for a while and generally I've liked it. It's useful and I'm grateful to the developers who share it with the rest of us. But the original poster was asking about putting in the effort to migrate an existing project that already uses another library to use jQuery, in part because of issues of modularity and compatibility. I can't recommend that without reservation if even point releases might introduce the kinds of backward-incompatible change I've mentioned here.
Or are you saying Prototype is more stable to develop on because it's own development is at a near stand still?
Also, if even the smallest increments (e.g., 1.3.1 to 1.3.2) can change fundamental behaviour in ways that may require adjustments in existing code to keep things working, then that is a negative point to balance the positive side of using a project under active development. It means you can't count on using any bug fixes or pure performance improvements without having to take on functional changes as well, and that is a significant maintenance risk.
We're still on jquery 1.3.2 and have no plans for upgrading until there's a genuine need (e.g. a plugin requiring a newer version).
Installing a freshly released version of anything is just asking for trouble.
Regarding participating in alpha and beta releases, as suggested by the GP post: speaking personally, I'm happy to contribute to projects I find worthwhile (which certainly includes jQuery). I did check whether the issues we had were known in the jQuery bug tracker, for example.
But my colleagues and I are contractors, often paid on a time and materials basis. I would not be comfortable billing my client for time I was spending testing and reporting bugs on pre-release versions of third party libraries, because that's not what my client pays me for. And that means that if I choose to use a certain library to support a project and then I spend time helping its pre-release testing, it has a direct financial cost to me.
Keeping in mind the context of this discussion -- whether someone should change their project from one library to another -- I think it is fair to balance any potential benefits from the rapid pace of development with awareness of these potential costs. It doesn't mean moving to jQuery is a bad idea, nor that jQuery's approach is wrong, nor that jQuery is somehow a bad project. It's just another factor that should be considered before making a decision.
There were two reasons why I stuck with Prototype:
* Things like Element.clonePosition(), Element.absolutize() and TimedObserver have no equivalent in jQuery. But now I've found plugins that implement the same features. * It's the default JS framework supported by Ruby on Rails. For my latest Rails app I just ignored all the Rails helpers and used jQuery directly.
if RoR you can use jRails to try to keep functionality in your app (if that's what you use)
"Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects. It's the tie to go along with jQuery's tux."
There is absolutely no way in which the check:
if ( selector === "body" && !context ) ...
Will have performance implications in your application.