在复杂的JavaScript应用程序(使用jQuery和jQueryUI)中,JavaScript偶尔会抛出错误。我们捕获并记录这些错误,但堆栈跟踪并未显示完整的原点。到目前为止,我们一直无法找到错误的根本原因。
RangeError: Maximum call stack size exceeded
at RegExp.[Symbol.replace] (native) at String.replace (native)
at Function.camelCase (<jquery>)
at Function.css (<jquery>)
at Object.get (<jquery>)
at init.cur (<jquery>)
at init (<jquery>)
at Function.Ya [as Tween] (<jquery>)
at Object.createTween (<jquery>)
at Object.r.Animation.r.extend.tweeners.* (<jquery>)
另一个:
RangeError: Maximum call stack size exceeded
at RegExp.[Symbol.replace] (native) at String.replace (native)
at Function.camelCase (<jquery>)
at Function.css (<jquery>)
at (<jquery>)
at S (<jquery>)
at a.fn.init.css (<jquery>)
at HTMLImageElement.jc (<jquery>)
at HTMLImageElement.e.complete (<jquery>)
at i (<jquery>)
有没有办法在不使用开发人员工具包的情况下找到错误的起源?这些错误似乎只发生在Chrome上,并且在我们使用旧版本的jQuery时没有发生。 (我们现在在3.1.1)
答案 0 :(得分:2)
我猜我们发现了这个错误。在这个JSfiddle中它出现了:
https://jsfiddle.net/c41bgs24/12/
function completeFunc(){
var $this = $(this);
var fadeIn = $this.css("opacity") == 0;
console.log("complete", (new Date()).getTime());
$this.animate({
opacity: fadeIn ? 1 : 0
}, 2000, "linear", completeFunc);
}
// Make sure the tab is switched out within 3 seconds. This tab needs to be inactive when the timeout triggers for the bug to take place.
setTimeout(function(){
$("#test").each(completeFunc);
}, 3000);
确保在3秒之前将其标记出来以确保错误发生。
我们已经向jQuery提交了一个错误报告: https://github.com/jquery/jquery/issues/3507