Something truly remarkable has happened.
Scott Gu has announced that jQuery is to be shipped with Visual Studio.
"I'm excited today to announce that Microsoft will be shipping jQuery with Visual Studio going forward. We will distribute the jQuery JavaScript library as-is, and will not be forking or changing the source from the main jQuery branch. The files will continue to use and ship under the existing jQuery MIT license.
We will also distribute intellisense-annotated versions that provide great Visual Studio intellisense and help-integration at design-time.
We will also extend Microsoft product support to jQuery beginning later this year, which will enable developers and enterprises to call and open jQuery support cases 24x7 with Microsoft PSS."
Well I'm glad to hear that Microsoft have finally caught on. I personally have been using jQuery as my JavaScript framework of choice since version 1.0.4.
For those of you who haven't heard of jQuery, it's a very lightweight cross-browser framework that easily allows you to manipulate the DOM to create JavaScript transitions etc.
For example, if you wanted to add some error text to a div you would write:
var ShowJqueryError = function() {
$('#ErrorMessage ul')
.append('<li>Please enter your login name</li>')
.parent()
.show();
};
This piece of jQuery will find the UL element which is a child of divErrorMessage and append the li error message to the list.
The quickest way to achieve the same effect with native JavaScript is:
var showError = function() {
var errorDiv = document.getElementById("ErrorMessage");
if (errorDiv !== null) {
var errorList = errorDiv.getElementsByTagName("ul")[0];
errorList.innerHTML += '<li>Please eneter your login name</li>'
errorDiv.setAttribute("style","display:block");
}
}
The two main reasons I chose to adopt jQuery as my JavaScript framework of choice were:
- It's cross-browser compatible out of the box, which means I don't have to write bucket loads of code to ensure a consistent browser spread.
- The selector style language (ID and class named base) is so close to CSS that the overhead of adopting it was low.
An added bonus is that it's quite fun to use too. Making it, for me at least, the best tool for the job.
Microsoft's support for jQuery is monumental, indicating a further shift in their attitude away from a command and conquer mind-set to creating the best development environment, whatever the tools.
Leave a comment