简体   繁体   English

有没有一个插件来验证jQuery代码?

[英]Is there a plugin to validate jQuery code?

Is there a jQuery plugin which can check our code before launch it ? 是否有一个jQuery插件可以在启动之前检查我们的代码?

Example: 例:

I write this : 我写这个:

jQuery('.myclass')css('color','red');

The plugin will show me some message like 'parse error line ...' because I forgot a period 该插件会向我显示一些消息,如“解析错误行...”,因为我忘记了一段时间

Or: 要么:

function test() {
    alert('test');
...
tet();

Message: The tet() function doesn't exist. 消息: tet()函数不存在。

EDIT: or maybe it could be some Firefox plugin ? 编辑:或者它可能是一些Firefox插件?

This can't be a plugin because if you have syntax errors in your code, the browser will stop execution and show an error. 这不能是插件,因为如果您的代码中存在语法错误,浏览器将停止执行并显示错误。 JSLint is an online service you could use to validate your javascript. JSLint是一种在线服务 ,可用于验证您的JavaScript。

除了上述建议之外,您可能还需要查看jQuery-lint - 一个在运行时检查jQuery代码并报告jQuery API使用不正确或次优的脚本。

As 'Darin Dimitrov' said jQuery is not a language to have some special syntax but it is a javascript library so the syntax validation should be done against javascript 正如'Darin Dimitrov'所说jQuery不是一种具有一些特殊语法的语言,但它是一个javascript库所以语法验证应该针对javascript完成

If you are using a IDE like Eclipse there are javascript plugins like spket , aptana which will help you to find out some syntax errors 如果您使用像Eclipse这样的IDE,那么有像spketaptana这样的javascript插件可以帮助您找出一些语法错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM