JSLint坚持认为使用.call有问题:
function GridView(tableArray, tableId, multiselect) {
"use strict";
if (multiselect == undefined) {
this.multiselect = false;
} else {
this.multiselect = multiselect;
}
this.tableID = tableId;
this.propertiesArr = [];
this.tableHTML = undefined;
this.oTable = undefined;
this._constructTable.call(this, tableArray);
}
Run Code Online (Sandbox Code Playgroud)
是错的.好吧,无论如何,意外.我只是不能为我的生活弄清楚为什么,代码有什么问题吗?它似乎工作,但我担心意外的行为.
Jam*_*ice 10
警告的原因如下:
this._constructTable.call(this, tableArray);
Run Code Online (Sandbox Code Playgroud)
这个结构似乎毫无意义 - 你_constructTable
在上下文中调用方法this
,如果你通过普通的调用表达式调用它,它将被调用.JSLint正好期待:
this._constructTable(tableArray);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1204 次 |
最近记录: |