JavaScript:Ci 未定义
我刚刚花了半个小时来找出导致我的 JavaScript 代码中出现错误消息“Ci 未定义”的原因。 我终于找到了原因:
它应该是(jQuery):
$("asd").bla();
它是:(
("asd").bla();
美元符号消失了)
现在解决了问题后,我想了解消息本身:当Firefox告诉我“Ci”时,它是什么意思没有定义。 什么是“慈”?
更新: 我正在使用当前版本的 Firefox (3.0.3)。
要重现,只需使用以下 HTML 代码:
<html><head><title>test</title>
<script>
("asd").bla();
</script>
</head><body></body></html>
为了明确起见:我知道是什么导致了错误消息。 我只是想知道 Firefox 试图通过“Ci”告诉我什么......
I just spent half an one our to find out what caused the Error-Message "Ci is not defined" in my JavaScript code. I finally found the reason:
It should be (jQuery):
$("asd").bla();
It was:
("asd").bla();
(Dollar sign gone missing)
Now after having fixed the problem I'd like to understand the message itself: What does Firefox mean when it tells me that "Ci" is not defined. What's "Ci"?
Update:
I'm using the current version of Firefox (3.0.3).
To reproduce, just use this HTML code:
<html><head><title>test</title>
<script>
("asd").bla();
</script>
</head><body></body></html>
To make it clear: I know what caused the error message. I'd just like to know what Firefox tries to tell me with "Ci"...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不知道您使用的是哪个版本的 FF,但无论如何,该消息可能指的是
bla()
不是 String 对象上可用的函数。 由于您缺少$
,这意味着您缺少一个函数,("asd")
将计算为字符串,然后 JavaScript 解释器将尝试调用 <该对象上的 code>bla() 。 因此,如果您的项目中有以下代码:那么,
Ci
可能是一些内部 Firefox 符号,仅指代函数的概念。 这是我的猜测,我想您需要了解 Firefox 内部结构的人才能更好地回答这个问题...更新:我正在完全相同相同的版本中运行您的示例代码FF 和你一样,但它报告错误为:
也许您正在运行一个扩展/插件来执行此操作? 也许有一些 Greasemonkey 脚本之类的?
I don't know which version of FF you are using, but regardless, the message is probably referring to the fact that
bla()
is not a function available on the String object. Since you were missing the$
, which means you were missing a function,("asd")
would evaluate to a string, and then the JavaScript interpreter would try to callbla()
on that object. So, if you had the following code in your project:So, it is possible that
Ci
is some internal Firefox symbol that simply refers to the idea of a function. That is my guess, I imagine you are going to need someone that knows something about Firefox's internals to get a better answer to this question...UPDATE: I am running your example code in the exact same version of FF as you are, but it reports the error as:
Perhaps you have an extension/plug-in running that does something with this? Maybe some Greasemonkey script or something?
杰森似乎是对的。 许多插件(例如 Firebug、Geode)使用 Ci 作为快捷方式:
因此这些插件似乎会导致奇怪的错误消息。
Jason seems to be right. Many plugins (e.g. Firebug, Geode) use Ci as a shortcut:
So the plugins seem to cause that strange error message.
假设是CodeIngiter,它找不到js文件。
Assuming it's CodeIngiter, it can't find the js file.