Javascript/JQuery 中 $H 的含义是什么?
这个 jsfiddle.net 示例 包括 $H
:
new Request.JSON({
url: '/echo/json/',
data: {
json: JSON.encode({
text: 'some text',
array: [1, 2, 'three'],
object: {
par1: 'another text',
par2: [3, 2, 'one'],
par3: {}
}
}),
delay: 3
},
onSuccess: function(response) {
show_response(response, $('post'));
}
}).send();
show_response = function(obj, result) {
$H(obj).each(function(v, k) {
new Element('li', {
text: k + ': ' + v
}).inject(result);
});
result.highlight();
};
我似乎无法找出 $H 的含义/功能。有人可以详细说明吗?
This jsfiddle.net example includes $H
:
new Request.JSON({
url: '/echo/json/',
data: {
json: JSON.encode({
text: 'some text',
array: [1, 2, 'three'],
object: {
par1: 'another text',
par2: [3, 2, 'one'],
par3: {}
}
}),
delay: 3
},
onSuccess: function(response) {
show_response(response, $('post'));
}
}).send();
show_response = function(obj, result) {
$H(obj).each(function(v, k) {
new Element('li', {
text: k + ': ' + v
}).inject(result);
});
result.highlight();
};
I can't seem to find the meaning/function of $H. Can someone elaborate?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
$H 与 mootools 相关,而不是 jQuery。您可以在此处找到该文档(第 67 页)。摘录如下:
$H is to do with mootools, not jQuery. You find the doc here (pg 67). Excerpt below:
$H
只是一个函数,由页面中的其他脚本之一定义(或从页面链接)。 JS 标识符可以包含 $;使用它只是因为它看起来很特别(凡人已经习惯了标识符的“仅单词字符”规则,因此它不太可能与其他人的东西发生冲突)。查看其他脚本以查找名为 $H 的函数,或者查找将 $(框架中非常常见的名称,因此可能会发生冲突)复制/移动到其他内容的代码。
$H
is just a function, defined by one of the other scripts in (or linked in from) the page. JS identifiers can contain $; it's just used because it looks special (and mortals are so used to the "only word chars" rules for identifiers, that it's unlikely to conflict with other people's stuff).Look through the other scripts for a function named $H, or for some code that copies/moves $ (a very common name in frameworks, and thus, likely to conflict) to something else.