Script isn't answering any more error using morris.js in firefox

匆匆过客 提交于 2019-12-24 02:13:58

问题


I am using the library morris.js http://www.oesmith.co.uk/morris.js/ in order to create charts for a website. It works on Opera, Internet Explorer and Google Chrome.

In Firefox, it randomly crashes instantly.

Script Panel tells me, it crashes here:

secondsSpecHelper = function(interval) {
    return {
        span: interval * 1000,
        start: function(d) {
        return new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(),     
        d.getMinutes());
    },
fmt: function(d) {
    return "" + (Morris.pad2(d.getHours())) + ":" + (Morris.pad2(d.getMinutes())) + ":" + 
    (Morris.pad2(d.getSeconds()));
},
incr: function(d) {
    return d.setUTCSeconds(d.getUTCSeconds() + interval);
}
};

Any ideas, if any of those functions are NOT working in Firefox? Or what could cause this crash?

I get the standard Firefox Error:

Script isn't answering anymore..


回答1:


Fixed! Morris.js and Mozilla tries to parse the "xLabels" attribute as a Datetime, and goes into a forever-loop then.

Fixed with the attribute

    parseTime: false

For example:

xxx = new Morris.Line({
    xLabels: 'day',
    parseTime: false
});


来源:https://stackoverflow.com/questions/23061821/script-isnt-answering-any-more-error-using-morris-js-in-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!