【发布时间】:2012-10-30 13:40:50
【问题描述】:
作为一个例子,从 jQuery 1.2.6 复制过来的:
jQuery.fn = jQuery.prototype = {
init: function( selector, context ) {
// Make sure that a selection was provided
selector = selector || document;
..........
},
};
我在这里阅读了一些帖子,例如JavaScript: What are .extend and .prototype used for?,并且知道可以在子类中使用原型来扩展某些方法。
但我无法理解上述 jQuery 中 sn-p 中的用法。
是否有任何描述原型的规范文档?
谢谢。
【问题讨论】:
-
查看标签信息参考。我特别建议您使用 Eloquent JavaScript 的 this article 和 ECMAScript 语言规范的 this one。
标签: javascript jquery