Question

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..

Was it helpful?

Solution

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
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top