日历插件版本:当前版本1.2.1Grails的日历插件抛出堆栈/递归误差
我也跟着步骤在Grails的插件文件,我得到了所有类型的浏览器下面的错误
铬提到14.0835:未捕获RangeError:超过最大Callstack大小。
火狐6.02:太多递归calendar.js线1851
IE 9:缺货堆栈空间calendar.js线1850
日历插件版本:当前版本1.2.1Grails的日历插件抛出堆栈/递归误差
我也跟着步骤在Grails的插件文件,我得到了所有类型的浏览器下面的错误
铬提到14.0835:未捕获RangeError:超过最大Callstack大小。
火狐6.02:太多递归calendar.js线1851
IE 9:缺货堆栈空间calendar.js线1850
有问题的jscalendar码是这样的:
Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear;
Date.prototype.setFullYear = function(y) {
var d = new Date(this);
d.__msh_oldSetFullYear(y);
if (d.getMonth() != this.getMonth())
this.setDate(28);
this.__msh_oldSetFullYear(y);
};
哪重新定义Date.setFullYear()
。看看"old jscalendar" page上的评论#124和#125。
注释#124(由Chris活泼)
:建议更新calendar.js(接近底部,〜行1850)。
For those getting the recursion error. You just need to comment a few lines. See below.
//Date.prototype.msh_oldSetFullYear = Date.prototype.setFullYear; Date.prototype.setFullYear = function(y) { var d = new Date(this); //d.msh_oldSetFullYear(y); if (d.getMonth() != this.getMonth()) this.setDate(28); //this._msholdSetFullYear(y); };
评论#125(由拉里莎回复)
The problem with recursion occurs due to multiple includes of calendar JavaScript on a page. As a result Date patch redefines setFullYear function twice and causes infinite loop when it gets executed. We fixed it by making sure that function is redefined only once:
if(Date.prototype.msh_oldSetFullYear == null) { Date.prototype.msh_oldSetFullYear = Date.prototype.setFullYear; }
这些都表明更新calendar.js,因为它与插件交付这是不理想的。
两个建议:
<calendar:resources/>
和你认为GSP?如果是这样,请删除其中的一个。我解决这个问题的方法是
1)下载创建具有相同名称的插件本地插件 2)的来源。 3)原始的源文件复制到本地插件我创建 4)改变了JavaScript文件上面 5所建议)编译和安装新创建我的主要项目 7)打包插件 6)删除旧的插件插件从步骤5创建的zip文件。
它的工作方式就像一个魅力。
感谢罗布Hruska的指点我在哪里,在javascript文件
此评论对我的作品:
if (Date.prototype.__msh_oldSetFullYear == null) {
Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear;
}
Date.prototype.setFullYear = function(y) {
var d = new Date(this);
Date.prototype.__msh_oldSetFullYear.apply(d, arguments);
if (d.getMonth() != this.getMonth())
this.setDate(28);
Date.prototype.__msh_oldSetFullYear.apply(this, arguments);
};
我面临同样的问题,我已经把我的主JSP <calendar:resources/>
以及在jsp中呈现的模板中。删除其中一个解决了这个问题。
非常感谢您将我指向正确的地方。正如你所说,我已经直接在插件的calendar.js中进行了更改并进行了测试。它的工作正常。但既然你也指出它不理想的插件文件,我需要寻找一个适当的方式来改变它。 – srisris