用法
jQuery.sub() => jQuery
jQuery.sub() => jQuery
说明:创建一个新的 jQuery 副本,其属性和方法可以在不影响原始 jQuery 对象的情况下进行修改。
-
添加的版本:1.5
jQuery.sub()
- 此方法不接受任何参数。
注意:这个 API 在 jQuery 1.9 中被移除了。
有两个特定的用例创建了 jQuery.sub()。第一个是提供一种在不完全破坏原始方法的情况下覆盖 jQuery 方法的轻松方式,另一个是帮助对 jQuery 插件进行封装和基本命名空间。
请注意,jQuery.sub() 不会尝试进行任何形式的隔离——这不是它的意图。 jQuery 子版本上的所有方法仍将指向原始 jQuery(绑定和触发的事件仍将通过主 jQuery,数据将通过主 jQuery 绑定到元素,Ajax 查询和事件将通过主 jQuery 等)。
请注意,如果您希望将其用于插件开发,您应该首先强烈考虑使用管理状态和插件sub-methods的jQuery UI小部件工厂之类的东西。使用 jQuery UI 小部件工厂的一些示例构建一个插件。
通过一些示例可以最好地说明此方法的特定用例。
例子:
向 jQuery 子程序添加一个方法,使其不暴露在外部:
|
覆盖一些 jQuery 方法以提供新函数。
|
创建一个返回 plugin-specific 方法的插件。
|
相关用法
- JQuery jQuery.support用法及代码示例
- JQuery jQuery.inArray()用法及代码示例
- JQuery jQuery.when()用法及代码示例
- JQuery Mobile jQuery.mobile.path.get()用法及代码示例
- JQuery jQuery.grep()用法及代码示例
- JQuery Mobile jQuery.mobile.navigate()用法及代码示例
- JQuery Mobile jQuery.mobile.path.isRelativeUrl()用法及代码示例
- JQuery jQuery.dequeue()用法及代码示例
- JQuery jQuery.escapeSelector()用法及代码示例
- JQuery Mobile jQuery.mobile.silentScroll()用法及代码示例
- JQuery jQuery.cssNumber用法及代码示例
- JQuery jQuery.map()用法及代码示例
- JQuery jQuery.readyException()用法及代码示例
- JQuery jQuery.parseJSON()用法及代码示例
- JQuery jQuery.contains()用法及代码示例
- JQuery Mobile jQuery.mobile.path.makePathAbsolute()用法及代码示例
- JQuery jQuery.each()用法及代码示例
- JQuery jQuery.unique()用法及代码示例
- JQuery jQuery.getJSON()用法及代码示例
- JQuery jQuery.proxy()用法及代码示例
- JQuery jQuery.ajaxSetup()用法及代码示例
- JQuery jQuery.type()用法及代码示例
- JQuery jQuery.cssHooks用法及代码示例
- JQuery UI jQuery.effects.define()用法及代码示例
- JQuery jQuery.parseXML()用法及代码示例
注:本文由纯净天空筛选整理自jquery.com大神的英文原创作品 jQuery.sub()。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。