【发布时间】:2010-02-24 02:57:53
【问题描述】:
我在哪里可以获得 jQuery 1.4.2 的 VSDoc?
【问题讨论】:
标签: jquery visual-studio vsdoc
我在哪里可以获得 jQuery 1.4.2 的 VSDoc?
【问题讨论】:
标签: jquery visual-studio vsdoc
冒险者可以从 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 );
}
},
该文档几乎是从 jQuery 网页以及当前对“生”和“死”的定义中提取的,但您可以随意调整。
另外,在第 224 行:
// The current version of jQuery being used
jquery: "1.4.2",
【讨论】:
您总是可以从http://docs.jquery.com/Downloading_jQuery 获得它 - 如果它还没有,那么它还不可用。 v1.4.1 已存在 - 请参见屏幕截图 - 但 1.4.2 尚未准备好。
【讨论】:
只是关于 Herb 的回答的注释。无论如何,对我来说,第 2940 行处于“触发”方法的中间。我在 2949 之后插入了代码。另外,由于我花了大约 45 分钟来弄清楚为什么 cmets 不能用于这两个新例程 - “摘要”标签中有一个太多的 'm'!
这是更正的版本:
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);
}
},
【讨论】:
不确定是不是“正式版”,但现在可以从微软CDN下载一个1.4.2-vsdoc文件:http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2-vsdoc.js
【讨论】:
最新的VSDoc支持版本好像是微软的v.1.4.4,可以找到 在http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4-vsdoc.js。
它是用于工具包的新 MS CDN(替换旧的 microsoft.com 域)。
【讨论】:
我决定根据这个问题和答案的输入创建一个并分享它。您可以从这篇博文下载它:
http://hugeonion.com/2010/06/26/here-is-the-missing-jquery-1-4-2-vsdoc-file/
希望有帮助!
【讨论】:
除了重命名 VSDoc 文件 (1.4.1) 之外,您可能还必须将 1.4.1-vsdoc.js 文件中使用的 jQuery 版本号更改为 1.4.2。
参见第 224 行,
// The current version of jQuery being used
jquery: "1.4.2",
【讨论】:
暂时您可以随时将“jquery-1.4.1-vsdoc.js”重命名为“jquery-1.4.2-vsdoc.js”,当他们发布新的 vsdoc 版本时,只需替换它。
注意:我必须修改脚本源路径,然后再次将其改回以强制 vs 获取 vsdoc。我只是在 src 属性值的开头添加了一个正斜杠,然后将其删除。
【讨论】:
约翰 T 说:
为了它的价值,从这个 问题:
jQuery 1.4.3 vsdoc
有人更新了 jQuery vsdoc 对于 jQuery 1.4.3。它位于:
@John T:感谢您的链接!
对于此处提供的 v1.4.4 VSDOC 文件的用户,有一个小错误会破坏 IntelliSense;在第 1751 行,文件读取:
jQuery.proxy = function(function, context){
这会导致 Visual Studio 显示以下错误:
Error updating JScript IntelliSense: <your path>\jquery-1.4.4-vsdoc.js: Expected identifier @ 1750:24(或足够接近)。
将此行更新为:
jQuery.proxy = function(method, context){
在 VS2008 中发现并解决了这个错误。
【讨论】:
为了它的价值,从这个问题:
有人为 JQuery 1.4.3 更新了 jQuery vsdoc。它位于:
【讨论】:
使用 jQuery 1.4.4 和来自 http://appendto.com/community/vsdoc 的 vsdoc(以及对 ~1750 行的修复),我可以毫无错误地更新我的 Intellisense;但是,每当我输入:
$。
我不仅没有得到任何相关的智能提示,而且我看到了:
Javascript Intellisense 消息:JSIntellisense:Internal/(3:4) : Object required
这引用了我的 .js 文件中的第一个函数:
; (函数($) { $.fn.MobileFunction = 功能(选项) {
//My Function
};
})(jQuery);
我确实有一个警告:“预期表达式”在 })(jQuery); 中的第一个右括号上但我在代码中找不到语法错误。即使将整个函数注释掉,Intellisense 也不会产生任何输出。
【讨论】:
FWIW,您可以使用托管在http://damianedwards.com/vsdoc 的在线工具为 jQuery 版本 1.4.2 及更高版本生成
此外,NuGet 中的 jQuery 包包含使用此工具生成的 vsdoc 文件。
这个工具实际上是从 api.jquery.com 抓取官方 API 文档并将其与(浏览器)内存中的实际 jQuery 对象合并,而不是尝试进行源合并。它不是 100% 完美,但非常接近(比旧方法更接近)。
另外,从这里的一些答案和 cmets 来看,有些人实际上是从他们的网页中引用 vsdoc 文件。不要这样做。 vsdoc 文件是专门为服务 Visual Studio IntelliSense 而构建的,无法在浏览器中正常工作。只需引用实际的 jQuery 文件(或 .min 版本),Visual Studio 就会自动找到它旁边的 .vsdoc 文件版本(包括如果您从 CDN 引用它)。
【讨论】:
此页面包含微软 CDN 上的 vsdoc 文件列表
http://www.asp.net/ajaxlibrary/cdn.ashx
只要搜索 vsdoc 你就会找到它:)
现在它不在官方 jquery 下载页面上
【讨论】:
你可以从这里得到它:
http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.2-vsdoc.js
这是一个由 Microsoft 托管的网站。
注意如果你需要一个更新的版本,比如说jQuery 2.1.0,只要改变上面路径中的版本,即:
http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.0-vsdoc.js
然后立即开始下载。
【讨论】:
【讨论】: