问题
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