【发布时间】:2013-11-20 04:02:58
【问题描述】:
亲爱的朋友们,Closure Compiler 在高级模式下会给出这个警告,下划线{this.
JSC_USED_GLOBAL_THIS:在第 200 行字符 33 处危险地使用全局 this 对象
hovers[i4].onfocus = function() {this.className += "Hovered";}
JSC_USED_GLOBAL_THIS:在第 201 行字符 32 处危险地使用全局 this 对象
hovers[i4].onblur = function() {this.className = this.className.replace(/Hove...
JSC_USED_GLOBAL_THIS:在第 201 行字符 49 处危险地使用全局 this 对象
hovers[i4].onblur = function() {this.className = this.className.replace(/Hove...
JSC_USED_GLOBAL_THIS:在第 218 行字符 38 处危险地使用全局 this 对象
buttons[i5].onmouseover = function() {this.className += "Hovered";}
第一季度。这有什么危险?
Q2。我应该改变这个吗?
Q3.如何改进/解决此代码?
谢谢!
【问题讨论】:
-
另见WARNING - dangerous use of the global this object,这是一篇较早的帖子,有更具体的问题和一些不错的答案。
标签: javascript jquery debugging google-closure-compiler