开发者

jQuery 1.4.2 VSDoc

开发者 https://www.devze.com 2022-12-21 05:43 出处:网络
Wher开发者_如何学编程e can I get the VSDoc for jQuery 1.4.2?The adventurous can add the following lines starting at 2949:

Wher开发者_如何学编程e can I get the VSDoc for jQuery 1.4.2?


The adventurous can add the following lines starting at 2949:

delegate: function( selector, types, data, fn ) {
/// <summary>
///   Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements. See also "live".
/// </summary>
/// <param name="selector" type="String">
///     An expression to search with.
/// </param>
/// <param name="types" type="String">
///     A string containing a JavaScript event type, such as "click" or "keydown".
/// </param>
/// <param name="data" type="Object">
///     A map of data that will be passed to the event handler.
/// </param>
/// <param name="fn" type="Function">
///     A function to execute at the time the event is triggered.
/// </param>
    return this.live( types, data, fn, selector );
},
undelegate: function( selector, types, fn ) {
/// <summary>
///   Remove a handler from the event for all elements which match the current selector, now or in the future, based upon a specific set of root elements. See also "die".
/// </summary>
/// <param name="selector" type="String">
///     An expression to search with.
/// </param>
/// <param name="types" type="String">
///     A string containing a JavaScript event type, such as "click" or "keydown".
/// </param>
/// <param name="data" type="Object">
///     A map of data that will be passed to the event handler.
/// </param>
/// <param name="fn" type="Function">
///     A function to execute at the time the event is triggered.
/// </param>
    if ( arguments.length === 0 ) {
            return this.unbind( "live" );

    } else {
        return this.die( types, null, fn, selector );
    }
},

That documentation is pretty much ripped from jQuery web pages and from current definitions of "live" and "die", but feel free to adjust as you see fit.

Also, at line 224:

// The current version of jQuery being used
    jquery: "1.4.2",


You always get it from http://docs.jquery.com/Downloading_jQuery - if it's not there yet, it's not available yet. v1.4.1 exists - see screenshot - but 1.4.2 isn't ready yet.

jQuery 1.4.2 VSDoc


Just a note on Herb's answer. Line 2940, for me anyway, was in the middle of the 'trigger' method. I inserted the code after 2949. Also, since it took me about 45 minutes to figure out why the comments weren't working for those two new routines - the "summary" tags have one too many 'm's in them!

Here's the corrected version:

        delegate: function(selector, types, data, fn) {
    /// <summary>
    ///     Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements. See also "live".
    /// </summary>
    /// <param name="types" type="String">
    ///     A string containing a JavaScript event type, such as "click" or "keydown".
    /// </param>
    /// <param name="data" type="Object">
    ///     A map of data that will be passed to the event handler.
    /// </param>
    /// <param name="fn" type="Function">
    ///     A function to execute at the time the event is triggered.
    /// </param>
    /// <param name="selector" type="String">
    ///     An expression to search with.
    /// </param>

        return this.live(types, data, fn, selector);
    },

    undelegate: function(selector, types, fn) {
    /// <summary>
    ///     Remove a handler from the event for all elements which match the current selector, now or in the future, based upon a specific set of root elements. See also "die".
    /// </summary>
    /// <param name="selector" type="String">
    ///     An expression to search with.
    /// </param>
    /// <param name="types" type="String">
    ///     A string containing a JavaScript event type, such as "click" or "keydown".
    /// </param>
    /// <param name="fn" type="Function">
    ///     A function to execute at the time the event is triggered.
    /// </param>
        if (arguments.length === 0) {
            return this.unbind("live");

        } else {
            return this.die(types, null, fn, selector);
        }
    },


Not sure if it is the "official version" but now a 1.4.2-vsdoc file can be downloaded from the Microsoft CDN: http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2-vsdoc.js


The latest VSDoc supported version seems to be v.1.4.4 from Microsoft and can be found at http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4-vsdoc.js.

It is the new MS CDN for toolkits (replacing the old microsoft.com domain).


I decided to create one based on the input from this question & answers and share it. You can download it from this blog post:

http://hugeonion.com/2010/06/26/here-is-the-missing-jquery-1-4-2-vsdoc-file/

Hope that helps!


As well as renaming the VSDoc file (1.4.1) you may also have to change the jQuery version number used in the 1.4.1-vsdoc.js file to 1.4.2.

See line# 224,

// The current version of jQuery being used
    jquery: "1.4.2",


For the time being you could always just rename "jquery-1.4.1-vsdoc.js" to "jquery-1.4.2-vsdoc.js" and when they release the new vsdoc version just replace it.

Note: I had to then modify the script source path and then change it back again to force vs to pick up the vsdoc. I just added a forward slash at the start of the src attribute value and then removed it.


John T said:

For what it's worth, and from this question:

jQuery 1.4.3 vsdoc

Someone has updated the jQuery vsdoc for JQuery 1.4.3. It's at:

http://appendto.com/community/vsdoc

@John T: Thanks for the links!

For users of the v1.4.4 VSDOC file supplied here, there is a slight error that breaks IntelliSense; at line 1751 the file reads:

jQuery.proxy = function(function, context){

This causes Visual Studio to show the following error:

Error updating JScript IntelliSense: <your path>\jquery-1.4.4-vsdoc.js: Expected identifier @ 1750:24 (or near enough).

Update this line to read:

jQuery.proxy = function(method, context){

This bug was found and resolved in VS2008.


For what it's worth, and from this question:

jQuery 1.4.3 vsdoc

Someone has updated the jQuery vsdoc for JQuery 1.4.3. It's at:

http://appendto.com/community/vsdoc


Using jQuery 1.4.4, and the vsdoc from http://appendto.com/community/vsdoc (as well as the fix for line ~1750), I can update my Intellisense without error; however, whenever I type:

$.

Not only do I not get any relevant Intelliprompts, but I see:

Javascript Intellisense Message: JSIntellisense:Internal/(3:4) : Object required

This references the first function in my .js file:

; (function ($) { $.fn.MobileFunction = function (options) {

   //My Function
};

})(jQuery);

I do have one warning: "Expected Expression" on the first closing paren in })(jQuery); but I cannot find a syntax error in the code. Even with the entire function commented out, Intellisense produces no output.


FWIW, you can generate for jQuery versions 1.4.2 and above using the online tool hosted at http://damianedwards.com/vsdoc

Also, the jQuery packages in NuGet contain vsdoc files generated using this tool.

This tool actually scrapes the official API documentation from api.jquery.com and merges it with the actual jQuery object in (browser) memory, rather than trying to do source merging. It's not 100% perfect, but it's very close (much closer than the old approach).

Also, judging by some of the answers and comments here, some people are actually reference the vsdoc file from their web pages. Do not do this. The vsdoc file is specifically built to service Visual Studio IntelliSense and will not work correctly in the browser. Just reference the actual jQuery file (or the .min version) and Visual Studio will automatically find the .vsdoc file version alongside it (including if you reference it from a CDN).


this page contain a list of vsdoc files on microsoft's CDN

http://www.asp.net/ajaxlibrary/cdn.ashx

just search for vsdoc and u will find it :)

right now its not on official jquery download page


You can get it from here:

http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.2-vsdoc.js

This is a web site hosted by Microsoft.

Note that if you need a newer version, say for jQuery 2.1.0, just change the version in above's path, i.e.:

http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.0-vsdoc.js

and the download instantly starts.


Looks like they have added the 1.4.2 to the JQuery download page:

http://docs.jquery.com/Downloading_jQuery

NM was looking in the wrong spot

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号