jQuery 1.4.3 Released

Posted on by

jQuery 1.4.3 is now out! This is the third minor release on top of jQuery 1.4, fixing some bugs and landing some nice improvements.

I would like to thank the following community members that provided patches and input for this release: Anton M., Justin Meyer, Colin Snover, Ryan Tenney, Louis-Rémi Babé, David Petersen, Rick Waldron, Dave Reed, John-David Dalton, temp01, Heungsub Lee, J. Ryan Stinnett, Robert Katic, Juriy Zaytsev, James Burke, Jeffery To, Carl Fürstenberg, Jacob Wright, Jeff Robinson, Christian C. Salvadó, Andrée Hasson, Jason Webster, Dave Furfero, Adam Sontag, Travis Hardiman, DBJDBJ, and Ben Alman.

Along with the following jQuery team members: Scott González, Brandon Aaron, Yehuda Katz, Dave Methvin, Karl Swedberg, Paul Irish, Ralph Whitbeck, Jörn Zaefferer, Richard Worth, Doug Neiner, and Mike Alsup.

Downloading

As usual, we provide two copies of jQuery, one minified (we now use the Google Closure Compiler as the default minifier) and one uncompressed (for debugging or reading).

You can feel free to include the above URLs directly into your site and you will get the full performance benefits of a quickly-loading jQuery.

Additionally you can also load the URLs directly from Google’s CDN:

General Improvements

We’ve made a number of improvements to the internals of jQuery and to the guidelines that we use for development.

JSLint

To start jQuery is now passing Douglas Crockford’s JSLint tool. We’ve integrated his tool into our workflow (checking out jQuery from Github and running ‘make lint’ will show the results) – giving us the ability to keep on top of possible regressions.

We’ve made a few minor changes to JSLint to suit our particular development style and have documented the results in the jQuery Core Style Guidelines.

Modularity

We’ve also removed a number of the inter-dependencies that exist in the jQuery source (inbetween modules). Doing this allows for a greater amount of flexibility when using a copy of jQuery from source. For example you could now use a script loader, such as LABjs or RequireJS to dynamically load individual jQuery modules (e.g. core, support, data, and events).

Additionally this change has made it so that you no longer need to build a copy of jQuery in order to run the jQuery test suite. This has dramatically improved our development workflow – allowing us to quickly make changes to jQuery and test the results without a (comparatively) slow build step.

New Features

All new features and changes can be found in the jQuery API documentation for 1.4.3.

CSS Module Rewrite

Nearly the entire CSS module has been rewritten focusing entirely on extensibility. You can now write custom CSS plugins that extend the functionality provided by .css() and .animate().

For example here is a plugin written by Louis-Rémi Babé that takes advantage of the new functionality: jQuery Rotate.

The plugin provides a cross-browser means of setting and animating the rotation of DOM elements just by using the traditional jQuery methods, like so:

$('#myDiv').css('rotate', 90);
$('#myDiv').animate({rotate: 180});

During the rewrite we broke down the functionality contained within jQuery into two very clear paths: Getting and setting an element’s .style property (done through jQuery.style) and getting the current computed style information of an element (done through .css() and jQuery.css – note that jQuery.curCSS is no longer used and is deprecated as a result). The functionality provided by .css() uses both the jQuery.style and jQuery.css methods.

Making this change has allowed for some speed-ups in computed style retreival, as well – yielding results that are up to 20% faster.

jQuery 1.4.3 .css() Getting a Value

The raw data for all the performance tests can be found in the following Google Doc Spreadsheet. All tests can be found in the jQuery source repository.

Data

The data module has seen a number of improvements greatly increasing its utility.

HTML 5 data- Atributes

To start the primary functionality provided by the jQuery Metadata plugin has been moved into core. HTML 5 data- attributes will be automatically pulled in to jQuery’s data object.

For example, given the following HTML:

<div data-role="page" data-hidden="true" data-options='{"name":"John"}'></div>

All of the following jQuery code will work.

$("div").data("role") === "page";
$("div").data("hidden") === true;
$("div").data("options").name === "John";

Note that strings are left intact while JavaScript values are converted to their associated value (this includes booleans, numbers, objects, arrays, and null).

The data- attributes are pulled in the first time the data property is accessed and then are no longer accessed or mutated (all data values are then stored internally in jQuery).

JavaScript Objects

A number of changes were made to when .data() is used on JavaScript objects (or, more accurately, anything that isn’t a DOM node). To start whenever you set data on a JavaScript object the data is set directly on the object – instead of going into the internal data object store. Additionally events that are attached to objects are put in a new ‘__events__’ property that is actually a function. This was done to allow events to be attached directly to an object, be garbage collected when the object is collected, and not be serialized by a JSON serializer. These changes should make jQuery’s data and event systems much more useful on JavaScript objects.

Events

jQuery has already had setData and getData events (which are broadcast whenever data is set or gotten through the .data() method) – overriding these methods makes it possible to override the default behavior for those features (namely you can return a different value or prevent a value from being set. Note that in jQuery 1.4.3 these events no longer bubble (allowing them to bubble proved to be too costly in most applications).

In 1.4.3 we’ve introduced a new event called changeData. This event is fired after any individual data properties are changed when using .data(). For example:

var user = new User();
$(user).bind("changeData", function( event, name, value ) {
  $("#user").find("#" + name).val( value );
});

The changeData event is used extensively by the new jQuery Data Linking plugin. It makes it possible for the data API to synchronize setting of JavaScript object properties with form fields.

Misc

There was one minor API change to .data() in 1.4.3: Calling .data(Object) no longer completely replaces the data object instead it extends the existing object, leaving the unspecified values in place. We found this to be the expected result based upon a number of confused bug reports.

Traversing

The performance of nearly all the major traversal methods has been drastically improved. .closest(), .filter() (and as a result, .is()), and .find() have all been greatly improved.

These improvements were largely the result of making greater use of the browsers querySelectorAll and matchesSelector methods (should they exist). The jQuery project petitioned the browsers to add the new matchesSelector method (writing up a test suite, talking with vendors, and filing bugs) and the whole community gets to reap the excellent performance benefits now.

jQuery 1.4.3 .closest() Performance

jQuery 1.4.3 .filter() on a Single Element

jQuery 1.4.3 .find() on an element

The raw data for all the performance tests can be found in the following Google Doc Spreadsheet. All tests can be found in the jQuery source repository.

The above performance results specifically look at three very common cases in jQuery code: Using .closest() on a single DOM node, using .filter() (or .is()) on a single DOM node, and using .find() rooted on a DOM element (e.g. $(“#test”).find(“something”)).

Note that the the browsers shown are those that actually support querySelectorAll or matchesSelector – existing browsers that don’t support those methods continue to have the same performance characteristics.

Ajax

A few new Ajax features have landed which should help plugin authors and those building progressively-enhanceable applications.

A new jQuery.readyWait property has been introduced which, when added to, delays the execution of the ready event. This should be used by plugins that wish to delay the ready event from occurring until a specified time. For example RequireJS has already implemented the use of this property allowing you to load dependencies that should be handled before the ready event fires. Whenever an item finishes loading you should end up calling jQuery.ready(true) (and if all dependencies are finished loading – and the DOM is ready – then the ready event will fire).

We’ve also added a new support property: jQuery.support.ajax. Simply this returns true in browsers that are capable of handling an ‘Ajax’ (XMLHttpRequest) request.

Events

.bind(“click”, false) and .unbind(“click”, false)

A convenient shortcut for binding a function that does nothing but return false (preventing the default action and stopping the event bubbling).

.click(data, fn)

All built-in event methods (such as .click()) now accept data as an initial argument (much like the bind method does).

event.namespace

A new property of the event object that contains the event namespace that was passed in to .trigger().

Effects

.show(speed, easing, callback), etc.

All animate methods now support easing. Much like how .animate() supports an easing argument (to be utilized by an easing plugin)

jQuery.fx.interval

A new property that exposes the rate at which all effects fire (in milliseconds – defaults to 13). Making this number smaller will make animations smoother in some browsers (such as Chrome) at the expense of CPU.

Misc

jQuery.type

Determine the internal JavaScript [[Class]] of an object. A number of different aspects are utilized to determine the exact return value for an object. The logic can be determined as follows:

  • If the object is undefined or null then “undefined” or “null” is returned accordingly.
  • If the object has an internal [[Class]] equivalent to one of the browser’s built-in objects we return the associated name. (More details about this technique.)
    • jQuery.type(true) === “boolean”
    • jQuery.type(3) === “number”
    • jQuery.type(“test”) === “string”
    • jQuery.type(function(){}) === “function”
    • jQuery.type([]) === “array”
    • jQuery.type(new Date()) === “date”
    • jQuery.type(/test/) === “regexp”
  • Everything else will return “object” as its type.

jQuery.isWindow

A simple method for determining if an object is likely to be a window.

jQuery.isWindow(window); // true

Additionally we now use he native Array.isArray method for jQuery’s isArray (if available) and we utilize the native String trim method provided by the browser (again, if available). A number of performance improvements were made to jQuery.trim, detailed in the following thread.

Testing

jQuery 1.4.3: Passing 3621 Tests in All Browsers

jQuery 1.4.3 is passing 3621 tests on all supported browsers. We’re 100% passing on Firefox 4 and nearly passing in IE 9 (we discovered two bugs, filed them, and one of them has already been fixed).

jQuery Community Updates 10/12

Posted on by

This is a big week for jQuery with our second release candidate for jQuery 1.4.3 already out and available for testing. We would like to thank everyone that’s been submitting their feedback and bug reports on it as they have been very helpful in making this release as stable as possible. Remember that if you’ve got a bug you would like to report, you can easily submit one through our bug tracker.

Our New Bug Tracker

Regarding the bug tracker, I would like to hand you over to Colin Snover who has an announcement to make about our bug tracking system:

Today we’ve introduced a new bug tracking system for jQuery core. In addition to being a lot faster and easier to use, the new Trac has a bunch of great new features that we hope you enjoy. We’ve tried hard to make sure that both end-users and developers are given a much better experience than what they were used to from the old service.

The most important change is the addition of voting, which will help the team prioritize which bugs and new features are of greatest concern to the members of the jQuery community. Up until now, there was no way to get such a concrete metric of which issues people felt were most important, so we’re very excited about this feature and hope you will use it to help us get an idea of what you want to see most in the library.

We added a login-free bug reporting mode, which will allow anyone to report a bug without needing to go through a registration process first. We also significantly improved the reporting process, so that when submitting a ticket, only a summary, description, version number, and issue type need to be provided.

Another great new feature of the new Trac is a more customisable notifications system, which allows anyone to pick and choose exactly when they receive emails about ticket changes. This feature also introduces the ability to “watch” tickets, so you can be kept up-to-date about tickets that you care about without needing to visit the bug tracker on a regular basis.

For jQuery developers, the new bug tracker offers a glut of improvements. Most visibly, we are now able to set up cross-references, so we know which issues block and are blocked by other tickets. We’ve also integrated support for GitHub, so changes to the jQuery GitHub repository are reflected automatically in Trac on the timeline and in the ticket system. Finally, changes have been made to the ticket workflow such that duplicate tickets can be addressed much more quickly, and tickets that are abandoned by their submitters are automatically closed to keep the number of invalid reports low.

We’re really excited about everything that has been added to the new bug tracker and we hope you will take a look today!

We encourage users to login when submitting a new bug report as this will allow you to see and use some of the new improved features such as the voting widget and notifications regarding follow-ups on your bug report. Let us know what you think about it!.

Community Support

One of the great things about our community is that we’re always ready and willing to give a hand to those just getting started out with jQuery.

In this spirit, we would like to invite members with experience using it to get involved with the jQuery Forums – this is a great place for assisting beginners with questions they may have about jQuery or just helping out members that are having some trouble getting their code to correctly function. To get started all you need to do is create a new forum account or alternatively sign in using your Google, Yahoo or Facebook account.

A Call For New jQuery And jQuery UI Tutorials

The jQuery & jQuery UI documentation sites are an excellent source of information on how to get started with jQuery, but we also like to provide the community with links to tutorials which might go into greater depth about particular topics.

If you enjoy writing about jQuery or jQuery UI, we would like to invite you to write an up-to-date tutorial on a particular aspect, function or component that we can then share with the rest of the community. The best tutorials may get added to our officially recommended tutorials page here.

Please feel free to get in touch if you would like to submit a tutorial for review.

jQuery Conferences

The Official jQuery Conference in Boston is going to be held on the 16th of this month and all jQuery team members attending are looking forward to seeing you there if you’re going. If you can’t make it however, don’t worry! No matter where you’re based, you can still register for the jQuery Online Summit running between November 16th-17th featuring speakers such as John Resig, Paul Irish, Rey Bango and many more.

Thanks and stay tuned for more updates from the jQuery team!

jQuery 1.4.3 Release Candidate 2 Released

Posted on by

jQuery 1.4.3 Release Candidate 2 is released! This is the second release candidate of jQuery 1.4.3. The code is stable (passing all tests in all browsers we support), feature-complete (we’re no longer accepting new features for the release), and needs to be tested in live applications.

Grab the code:

NOTE: If you’re using jQuery 1.4.3rc2 and you run into an error please make sure that you’re using the regular version of the code, it’ll make it easier to spot where the error is occurring.

How can I help?

To start, try dropping the above un-minified version of jQuery 1.4.3rc2 into a live application that you’re running. If you hit an exception or some weirdness occurs immediately login to the bug tracker and file a bug. Be sure to mention that you hit the bug in jQuery 1.4.3rc2!

We’ll be closely monitoring the bug reports that come in and will work hard to fix any inconsistencies between jQuery 1.4.2 and jQuery 1.4.3.

More details regarding the 1.4.3 release can be found in the previous post on jQuery 1.4.3rc1.

jQuery 1.4.3 Release Candidate 1 Released

Posted on by

jQuery 1.4.3 Release Candidate 1 is released! This is the first release candidate of jQuery 1.4.3. The code is stable (passing all tests in all browsers we support), feature-complete (we’re no longer accepting new features for the release), and needs to be tested in live applications.

Grab the code:

NOTE: If you’re using jQuery 1.4.3rc1 and you run into an error please make sure that you’re using the regular version of the code, it’ll make it easier to spot where the error is occurring.

How can I help?

To start, try dropping the above un-minified version of jQuery 1.4.3rc1 into a live application that you’re running. If you hit an exception or some weirdness occurs immediately login to the bug tracker and file a bug. Be sure to mention that you hit the bug in jQuery 1.4.3rc1!

We’ll be closely monitoring the bug reports that come in and will work hard to fix any inconsistencies between jQuery 1.4.2 and jQuery 1.4.3.

What to Watch For

There are a few areas in jQuery that have seen extensive changes since 1.4.2 was released:

  • .css() and related css-handling methods were all overhauled.
  • Logic for determining element visibility and toggling of display in animation code.
  • Much of the traversing logic has been improved and changed (is, filter, closest, find).

Full details concerning the release are forthcoming – for now we just need your help in catch regressions.

With your input we should be able to produce a solid release. Right now we’re looking to get the final 1.4.3 release out in time for the jQuery Conference in Boston this next weekend. Thanks for your help in reviewing jQuery 1.4.3rc1!

New Official jQuery Plugins Provide Templating, Data Linking and Globalization

Posted on by

As the jQuery project has grown, so have the needs of the developer community. As a project, we’re focused on building the best features possible and providing them in a reliable and open manner. Like most open-source projects, the software we’re able to offer is in no small part due to the generosity of many volunteers who donate their time and coding skills to make jQuery and jQuery UI some of the most widely used JavaScript libraries available.

In March, we announced at MIX 2010 that Microsoft had committed to supporting the jQuery Project via code contributions and resources. Shortly thereafter, Microsoft made available for public review their first jQuery plugin which provided client-side templating capabilities to the jQuery community. This was soon followed by their second plugin, jQuery Data Link, which offered data synchronization capabilities and, most recently, the jQuery Globalization plugin which offers globalization information to JavaScript applications for over 350 cultures ranging from Scottish Gaelic, Frisian, Hungarian, Japanese, to Canadian English.

During the seven months of development, the jQuery and Microsoft teams worked closely to ensure that the code conformed to the best practices specified by the jQuery project and filled specific needs of the jQuery community. We also ensured that any code contributed would be available to the jQuery community under the same non-restrictive licensing terms as the jQuery JavaScript Library.

Official jQuery Plugins

Today, we’re very happy to announce that the following Microsoft-contributed plugins – the jQuery Templates plugin, the jQuery Data Link plugin, and the jQuery Globalization plugin – have been accepted as officially supported plugins of the jQuery project. As supported plugins, the jQuery community can feel confident that the plugins will continue to be enhanced and compatible with future versions of the jQuery and jQuery UI libraries.

The jQuery Templates and jQuery Datalink plugin will be managed by the jQuery Core team while the jQuery Globalization plugin will become part of the jQuery UI project, allowing for extended globalization functionality for our rich UI library. In addition, the functionality found in the jQuery Templates plugin will be directly integrated into the jQuery Core library starting with version 1.5.

Documentation and Tutorials

To help you immediately use these plugins, we’re providing API documentation and tutorials that will help you ramp up on these new technologies.

API Documentation

Tutorials

Available for Download

Source code for the new plugins can be found on Github and we encourage the community to evaluate & enhance the functionality. The new plugins are available immediate download and the code can be found here:

jQuery Templateshttp://github.com/jquery/jquery-tmpl
jQuery Datalinkhttp://github.com/jquery/jquery-datalink
jQuery Globalizationhttp://github.com/jquery/jquery-global

New Contribution Vehicle

We’d like to thank Microsoft for their commitment to helping the jQuery Project and providing new and exciting functionality for the jQuery libraries. This has been a rewarding experience for both teams, laying the foundation for future collaboration and creating a new path for meeting the needs of the jQuery community.

Please be sure to read Microsoft’s joint announcement outlining the history of the effort and the importance of these contributions to Microsoft and the jQuery community:

jQuery Templates, Data Link, and Globalization Accepted as Official jQuery Plugins – Scott Guthrie, Corporate Vice President in the Microsoft Developer Division

jQuery Templates is now an Official jQuery Plugin – Boris Moore, Microsoft

jQuery Templating in the wild – James Senior, Microsoft

Web Camps TV #5 – Microsoft Commits Code to jQuery!
– Channel 9 Video

Seattle jQuery Open Space and Hack Attack with John Resig – July 5th

Posted on by

On Monday, July 5th, John Resig will be at the Seattle jQuery/JavaScript community meetup at Amazon’s brand new Van Vorst Meeting Center in South Lake Union for an afternoon of learning, openspace, hacking and, of course, pizza!

The fun begins at 1pm with a quick keynote and explanation of open space technology then the group will self organize into smaller sessions run in an open space style until 6pm.

There will be plenty of pizza, refreshments and networking space to meet like minded developers, so come and meet, eat, learn and play with some of the Pacific Northwest’s best front end and interface developers. Topics will be suitable for beginners all the way through to advanced jQuery and JavaScript programmers.

This awesome event is provided for free and but you need to register to get in. Be sure to get your ticket quick.

Microsoft’s Proposal for Data Linking in jQuery. Feedback Requested.

Posted on by

Microsoft has submitted it’s second proposal to the jQuery Project outlining a plugin that allows properties within objects to be linked to each other. Termed “data linking”, the new plugin would allow changes made to a property of one object to effect a change on the property of a secondary object. The plugin leverages jQuery’s “special events” API to create a new event that will trigger when a change occurs on a bound object property. This would allow a developer to link properties in the following way:

var person = {};

$(“#name”).linkTo(“val”, person, “name”);

$(“#name”).val(“foo”);

alert(person.name); // foo

// … user changes value …
alert(person.name); // user typed value

The proposal has been submitted via the jQuery forums and Microsoft is actively soliciting community feedback:

http://forum.jquery.com/topic/proposal-for-adding-data-linking-to-jquery

A prototype of the data linking is available for review via Github:

http://github.com/nje/jquery-datalink

We’re pleased to see Microsoft’s continued contribution to our open source community and ask that you provide feedback in guiding this effort along.

Microsoft to Expand its Collaboration with the jQuery Community

Posted on by

The jQuery Project is excited to announce that Microsoft is expanding its support of the jQuery JavaScript Library through new initiatives, to include code contributions, product integration, and the allocation of additional resources.

Building on two years of collaboration with the jQuery Project, Microsoft announced today at MIX 2010 that it will be working with the jQuery Core Team and community to provide source code that will help to further advance the jQuery JavaScript Library. The planned contributions target specific functionalities in areas of mutual interest. They include:

  • Templating
  • Script Loading
  • Data Binding

The initial focus will be on a new templating engine that will allow for easy and flexible data rendering via defined templates. Microsoft has submitted a proposal for public review along with an experimental plugin, and is actively collaborating with the jQuery team and community on a unified implementation. The templating engine will be reviewed and considered for inclusion into the jQuery JavaScript Library or maintained as an official jQuery plugin.

Microsoft will also ship a current release of the jQuery JavaScript Library in both Visual Studio 2010 and ASP.NET MVC as well as continue to host current versions of the library on the Microsoft CDN.

Lastly, Microsoft will be providing resources to assist in QA testing of jQuery in new environments to ensure continued stability and longevity of the library.

We see these contributions as a tremendous benefit to the jQuery effort and community and look forward to continued collaboration with Microsoft.