Microsoft and jQuery

 

James Senior gave a talk at the 2010 jQuery conference in Mountain View, California. Below are some brief notes from this talk.

History of Microsoft and Web Development

  • 1997: Classic ASP
  • 2002: ASP.NET 1.0 and WebForms
    • Ajax Control Toolkit
  • 2008: Shipping jQuery and jQuery Support
  • 2009: ASP.NET MVC
    • jQuery included
  • 2009: ASP.NET Ajax Library
  • 2009: jQuery on the MSFT CDN

ASP.NET Ajax Library

We built some features into this library, because ASP.NET developers were telling us that they needed them. These include:

  • Script Loader
  • Data-Binding
  • Observer class
  • Templating
  • Data Controls

We also added some jQuery integration, as the two work well together.

Script Loader

When you build applications on the client size, and larger applications get complex really quickly. The most popular way to simplify applications is to break them into smaller chunks, so the code is more maintainable. We've done the same thing with the Ajax Library. The Script Loader is used to load the Ajax Library. You can specify that you want to use, for example, the DataContext, and the Script Loader will load all the dependencies of DataContext for you. All of that complexity is abstracted away. You can load these Microsoft libraries, but you can also use ScriptLoader to load parts of your own libraries through configuration settings.

Script Loader is one of the things that we're looking to contribute back to jQuery.

Part of this library is JQueryStart.debug.js. This file is basically jQuery with Script Loader on top of it.

[James gave a demo of writing some jQuery code using Script Loader, along with the code that helps Script Loader determine the dependencies and sequences of dependencies.]

Complimentary features

jQuery has selectors, plugins, and animations. Our ASP.NET Ajax has client templates, data binding, script loader, WCF, OData, and .NET RIA. We saw that the next features that we were going to build were in jQuery and also complimentary to jQuery.

Last month, we announced that some of our features would be contributed to the jQuery project.

The reactions were generally positive. Microsoft isn't normally associated with open source, but we love to contribute, and jQuery is a great way to do that.

Our Contribution Model

It's pretty much exactly the same as anyone would contribute code to jQuery today. We're not doing anything differently:

  • Open, transparent and collaborative
  • In the spirit of jQuery community
  • Spec, proposals are all available on the jQuery forums
  • New features and prototypes as plugins in Github. Core teams will move this to core as they see fit.
  • Cool stuff: Templating, script loader, data-binding

What about ASP.NET Ajax Library?

We'll still support it and it's still served on the CDN, but we won't add any new features to it, because we've decided we're going to contribute to jQuery instead.

Template Syntax

There are two syntaxes you can use to define templates:


var tmpl = "

  • ${ dataItem }
  • ";

    You want to have different ways to define templates, because sometimes you will have simple templates, but you might want to use the more extended syntax with larger templates that are harder to squeeze into variables.

    To render the data object, you can call:


    $("#myTemplate")
    .render( dataObject )
    .appendTo("ul");

    Or, you can do:


    var tmpl = "

  • ${ dataItem }
  • ";
    $("ul").append( tmpl, dataObject );

    Thanks to James for giving this talk.

    1 Comment

    Did you enjoy this post? Please spread the word.