admin管理员组文章数量:1429108
My code looks like this:
$.extend($.fn.dataTableExt.afnSortData, {
'dom-text': function (oSettings, iColumn) {
var aData = [];
$('td:eq(' + iColumn + ') input', oSettings.oApi._fnGetTrNodes(oSettings)).each(function () {
aData.push(this.value);
});
return aData;
},
'dom-data-rk': function (oSettings, iColumn) {
var aData = [];
$('td:eq(' + iColumn + ')', oSettings.oApi._fnGetTrNodes(oSettings)).each(function () {
aData.push($(this).attr('data-rk'));
});
return aData;
}
});
I used JSLint and it came up with an error:
Warning 21 JS Lint: Unexpected dangling '_' in '_fnGetTrNodes'.
Can someone explain what this means? I don't understand the error message at all :-(
My code looks like this:
$.extend($.fn.dataTableExt.afnSortData, {
'dom-text': function (oSettings, iColumn) {
var aData = [];
$('td:eq(' + iColumn + ') input', oSettings.oApi._fnGetTrNodes(oSettings)).each(function () {
aData.push(this.value);
});
return aData;
},
'dom-data-rk': function (oSettings, iColumn) {
var aData = [];
$('td:eq(' + iColumn + ')', oSettings.oApi._fnGetTrNodes(oSettings)).each(function () {
aData.push($(this).attr('data-rk'));
});
return aData;
}
});
I used JSLint and it came up with an error:
Warning 21 JS Lint: Unexpected dangling '_' in '_fnGetTrNodes'.
Can someone explain what this means? I don't understand the error message at all :-(
Share Improve this question edited Sep 28, 2012 at 12:55 James Allardice 166k22 gold badges334 silver badges315 bronze badges asked Sep 28, 2012 at 12:37 Alan2Alan2 24.7k86 gold badges276 silver badges481 bronze badges4 Answers
Reset to default 4JSLint simply doesn't like identifiers to begin with an underscore character. Change the identifier and the warning will go away, or add the following directive to the top of the file:
/*jslint nomen: true */
The reason it doesn't like them is that people often use it to indicate a "private" variable, but doesn't actually change the behaviour of the variable.
Do not use _ (underbar) as the first character of a name. It is sometimes used to indicate privacy, but it does not actually provide privacy. If privacy is important, use the forms that provide private members. Avoid conventions that demonstrate a lack of petence.
more about code conventions used by JSLint here
You can simply set "tolerate dangling _ in identifiers" to true to ignore this error.
Well, JSlint doesn't like a variable name that begins with an underscore (_
).
It is better to use JShint. instead of JSlint. It's a fork of JSlint and provide you more options of configuration and doesn't show stupid errors like this. https://stackoverflow./a/10763615/1149495
本文标签: javascriptJS Lint Unexpected dangling 3939 in 39fnGetTrNodes39Stack Overflow
版权声明:本文标题:javascript - JS Lint: Unexpected dangling '_' in '_fnGetTrNodes' - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745516842a2661594.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论