如果我使用不同的var语句,如
function stretchDiv(){
var wh = $(window).height();
var sz2 = wh - ((paddingTop + paddingBottom) + (mainTop + 2) * 2);
// the scrollbar happens only when the height of the elt is constrained
var sz3 = sz2 - outTop - 2;
$('#out').css({'height': sz3 + 'px'});
}
Run Code Online (Sandbox Code Playgroud)
然后JSLint抱怨,告诉我将第二个和第三个与前一个结合起来.

如果我遵循这个建议,JSLint很高兴,但是Emacs的内置js-mode.el(Emacs v23.2)并没有var按照我想要的方式缩进附加声明.此外,它不会对其他变量执行字体锁定.看到:
function stretchDiv(){
var wh = $(window).height(),
sz2 = wh - ((paddingTop + paddingBottom) + (mainTop + 2) * 2),
// the scrollbar happens only when the height of the elt is constrained
sz3 = sz2 - outTop - 2;
$('#out').css({'height': sz3 + 'px'});
}
Run Code Online (Sandbox Code Playgroud)

如何获得正确的缩进和字体锁定?
| 归档时间: |
|
| 查看次数: |
765 次 |
| 最近记录: |