jQuery vsdoc File Generator

I’m now hosting my jQuery vsdoc File Generator for all to use. We use this tool to generate the vsdoc files for jQuery that are hosted on the Microsoft Ajax CDN. It downloads the official documentation XML source from http://api.jquery.com/api and merges it with the actual jQuery object in JavaScript to ensure you get the best documentation possible in Visual Studio IntelliSense.

It also supports generating the vsdoc file contents with <para> tags, for use with the JScript Editor Extensions, to further enhance your jQuery IntelliSense experience in Visual Studio 2010.

For those interested, the source can be found on the ASP.NET CodePlex site.

About these ads

19 Comments on “jQuery vsdoc File Generator”

  1. [...] VSDoc this week. After looking around myself, I didn’t see one anywhere either. So, I updated Damian Edwards’ VsDocBuilder for jQuery 1.5 and generated a new [...]

  2. Frédéric Hewitt says:

    I like so much… Tanks for the update, I live without that since 1.4.2 (never take the time to see if someone update it)

    But I don’t know if it’s the vsdoc, Intellisense or javascript fault, but I came with this little bug :

    jQuery.noConflict();
    jQuery(function($) {
    // $ is not recognized by Intellisense
    });

    After little investigation, I’ve found an other broken case (which clearly is an Intellisense bug) :
    (function ($) {
    // $ not recognized by Intellisense…
    }(jQuery));

    The following solution don’t work correctly :
    ///

    So, I’ve came with this solution :
    jQuery(function() {
    var $ = jQuery;
    });

    But it’s a poor workaround. Do you have a better option ?

    • Frédéric Hewitt says:

      Oups… Must read :

      The following solution don’t work correctly :
      /// <param name=”$” type=”jQuery” />

    • This is a known limitation with the JavaScript IntelliSense in VS2010. It does not currently support inferring the type of parameters from the execution. It only supports it from vsdoc comments. In the case of passing jQuery as a parameter value and the /// not fixing it, this is due to the way the param comments work. The type attribute actually refers to a prototype, not the actual object. So what you’ll get is IntelliSense for an object that is the result of calling “new jQuery()”, which is not quite right.

  3. Nicholas says:

    Thanks for this, but since updating to 1.5 I can’t get the VSDoc working in 2008.. getting an error:

    Error updating JScript IntelliSense: jquery-1.5-vsdoc.js: ‘class2type’ is undefined @ 2490:2

    Any ideas? :)

  4. Michael says:

    Thanks for the tool Damien, since I’m using Visual Studio Express which doesn’t support the extension that adds para tag support, is it possible the non-para version comes out like this which is nicer to read?

    http://pub.a2cdn.net/jquery-vsdoc/jquery-1.4.4-vsdoc.js

    • @Michael: Thanks for that information. I’ve updated the vsdoc generator to support generating files with those XML entities used for new-lines. The jquery.vsdoc NuGet package now includes a vsdoc file using that technique, so you can grab it using NuGet:

      PS> Install-Package jQuery.vsdoc

  5. Paolo Brocco says:

    Hi Damian, thanks for your generator, it’s really useful. I know, maybe it’s trivial, but I like reporting my “discoveries”: I found on another post a direct link to the final generated vsdoc file (http://damianedwards.com/files/jquery/jquery-1.5-vsdoc.js) (btw why don’t you do one also for 1.5.1 it could save some server requests done with the generator). I tried to generate the same with your generator, but what I get is a file with a smaller size (186 KB instead of 210 KB), and no line breaks and no comments inside the jQuery functions. I guess it was meant to be like that to save some space? Anyway the most important thing is that it works. So thanks again for sharing your work.

  6. Tony Whalen says:

    Just watched your ‘practical javascript’ video from Mix11 which was excellent. I’d like to try using the jquery.ui-webforms.js file you showed which hooked up the jQuery UI widgets unobtrusively using the HTML5 ‘data-‘ attributes. Is this file available from anywhere?

    Thanks

    • Joe Stagner just blogged about it at http://www.msjoe.com/2011/05/unobtrusive-javascript-in-your-asp-net-pages/. The version he’s using doesn’t support passing options to the jQuery UI via data-* attributes though, like my MIX talk showed. That version is below:


      /// <reference path="jquery-1.5.2.js" />
      /// <reference path="jquery-ui-1.8.11.js" />
      (function ($) {

      $(function () {

      // Wire-up jQuery UI unobtrusively
      $("*[data-ui-fn]").each(function () {
      var el = this,
      $el = $(this);

      // Loop through functions in data-ui-fn attribute
      $.each($el.attr("data-ui-fn").split(" "), function () {
      var fn = this,
      options = {},
      optionPrefix = "";

      optionPrefix = "data-ui-" + fn + "-";

      // Build options parameter from data-ui-fn-* attributes
      $.each(el.attributes, function () {
      var attr = this;

      if (attr.name.indexOf(optionPrefix) === 0) {
      options[attr.name.substr(optionPrefix.length)] = attr.value;
      }

      });

      // Call jQuery UI fn if it exists
      ($el[fn] || $.noop).call($el, options);

      });
      });
      });

      } (jQuery));

      • Tony Whalen says:

        Thanks Damian

        The script works really nicely. I’ve just made a couple of improvements which I thought I’d share.

        The first is to avoid testing all possible attributes in IE (there are lots) and the second was to support ‘array’ style options; e.g. the tabs widget allows you to pass an array of tab indexes to disable which can now be done like data-ui-tabs-disabled=”[1, 3]”

        // Build options parameter from data-ui-fn-* attributes
        $.each(el.attributes, function () {
        if (this.specified) { // Avoid testing all possible attributes in IE
        var attr = this;
        if (attr.name.indexOf(optionPrefix) === 0) {
        if (attr.value.toString().substr(0, 1) === “[“) { // Handle array options
        options[attr.name.substr(optionPrefix.length)] = eval(attr.value);
        }
        else {
        options[attr.name.substr(optionPrefix.length)] = attr.value;
        }
        }
        }
        });

  7. Anonymous says:

    Could you add 1.6.4 to the list please!

  8. Andy Cohen says:

    Do the JScript Editor Extensions play nicely with Mads’ Web Essentials? I’m wondering if the code folding is going to conflict.

  9. wavedrop says:

    If you are looking for more recent versions of jQuery I think this is the link that you want. It’s built on Azure. Nice job.

  10. Hi! Do you use Twitter? I’d like to follow you if that would be okay.
    I’m undoubtedly enjoying your blog and look forward to new updates.

  11. It is appropriate time to make some plans for the future and
    it is time to be happy. I have read this post and if
    I could I want to suggest you some interesting things or advice.
    Maybe you can write next articles referring to this article.
    I want to read even more things about it!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 34 other followers