New Microsoft support for jQuery makes part of its platform open source

One of the most exciting innovations in JavaScript is a tiny little open source library that makes functionality directly assignable to objects rather than to events. The surprise is that Microsoft has signed on as its key distributor.

It is now an established fact that JavaScript is the functionality language of the Web; and although it was Netscape that introduced us to it, and although those responsible are now at Mozilla, it's Microsoft that has taken the lead in recent years in accelerating its evolution. One major step was its embrace of AJAX two years ago. Another step, announced yesterday, may be just as big: the inclusion in its standard JavaScript of a very small, very potent library called jQuery that alters the dynamics of how Web pages work.

A key part of the programming model originally made popular in the early '90s by Visual Basic is the event-driven concept, where an application waits for a recognized event to occur, so that the event can trigger the execution of a procedure. The event model is simpler on a closed system, but Web programming mandates a more asynchronous approach, because the browser and the server are running independent processes, and there could be middleware -- perhaps a cloud service -- somewhere in between.

While jQuery sounds like a database language, that's not the category to which "Query" refers in this instance. Here, the idea is to change the response model for programming, so that the dynamics become less reliant upon if something happens -- less reactionary -- and more forward-thinking: when something happens.

With JavaScript code, you often have event functions that respond to a given trigger. For example, you may have a function that responds to the .onload event for the window object representing the active document, and you may have several functions that respond to the .onclick event for an object or a class of object. These functions are often assigned to the event as though they were values unto themselves, using the assignment operator =.

With jQuery added, the concepts are radically simplified. Rather than write out a whole bunch of event handling functions as if the events were the subjects, you maintain the context of the objects you're working on using the event names as modifiers of that object.

Here's an example from the jQuery team's John Resig: Suppose a list element in a page has been given the name orderedlist. A default function, using jQuery syntax, responds to the event signaling the active document being "ready" (fully rendered) by forwarding a set of event-oriented instructions saying, in effect, "When the user hovers over the last element in this list, turn it green until the pointer strays off of it."

$(document).ready(function() {
 $("#orderedlist li:last").hover(function()
 { $(this).addClass("green");

The li:last part is based on an XPath selector that has the script look for the final item in the list. The .hover event is something you'll recognize because it's a common term, but here it's being referenced as a method of the class that's returned by the selector. So every method chained onto to the end thereafter refers to the same object, and every reference to $(this) also refers to the same object -- it's shorthand for "the object at hand." So the .addClass and .removeClass jQuery functions are passed as parameters to the .hover event, essentially assigning and removing, respectively, a pre-existing CSS class green to that "object at hand."

As John Resig announced in a blog post on Sunday, "Microsoft is looking to make jQuery part of their official development platform. Their JavaScript offering today includes the ASP.NET AJAX Framework and they're looking to expand it with the use of jQuery. This means that jQuery will be distributed with Visual Studio (which will include jQuery Intellisense, snippets, examples, and documentation)."

Microsoft Vice President and ASP.NET development team leader Scott Guthrie announced this in his blog Sunday: "Providing the ability to perform selection and animation operations like above is something that a lot of developers have asked us to add to ASP.NET AJAX, and this support was something we listed as a proposed feature in the ASP.NET AJAX Roadmap we published a few months ago. As the team started to investigate building it, though, they quickly realized that the jQuery support for these scenarios is already excellent, and that there is a huge ecosystem and community built up around it already...Rather than duplicate functionality, we thought, wouldn't it be great to just use jQuery as-is, and add it as a standard, supported, library in VS/ASP.NET, and then focus our energy building new features that took advantage of it?"

As Microsoft Senior Program Manager Scott Hanselman confirmed Sunday, jQuery will eventually be shipped as part of Visual Studio, but will in the meantime be distributed as part of the new ASP.NET Model View Controller.

This officially makes an open source component part of Microsoft's standard Web page development platform.

"This is cool because we're using jQuery just as it is. It's Open Source, and we'll use it and ship it via its MIT license, unchanged. If there's changes we want, we'll submit a patch just like anyone else," Hanselman wrote. "Folks have said Microsoft would never include Open Source in the platform, I'm hoping this move is representative of a bright future."

© 1998-2017 BetaNews, Inc. All Rights Reserved. Privacy Policy.