sunjavagroups / flot

Automatically exported from code.google.com/p/flot
MIT License
0 stars 0 forks source link

Error in parseData for IE9 quirks mode #562

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When using flot with Internet Explorer 9.0 compatible mode / quirks mode the 
function parseData throws a property "data" not found exception.

Original issue reported on code.google.com by alexande...@googlemail.com on 24 Jun 2011 at 6:39

GoogleCodeExporter commented 8 years ago
I found out that the programm has length of 3 altough it should be 2. (line 307 
in jquery.flot.js).

Original comment by alexande...@googlemail.com on 24 Jun 2011 at 6:41

GoogleCodeExporter commented 8 years ago
I make a work around by add try catch:

function parseData(d) {
  var res = [];
  for (var i = 0; i < d.length; ++i) {
    try {
      var s = $.extend(true, {}, options.series);
      if (d[i].data != null) {
        s.data = d[i].data; // move the data instead of deep-copy
        delete d[i].data;
        $.extend(true, s, d[i]);
        d[i].data = s.data;
      }
      else
        s.data = d[i];
      res.push(s);
    }
    catch(exc) { }
  }
  return res;
}

I works in ie and chrome. I did not test any other browser.

Original comment by alexande...@googlemail.com on 24 Jun 2011 at 6:45

GoogleCodeExporter commented 8 years ago
Hi!

Could you please post a small test case that reproduces this? I don't 
understand what the problem is.

Original comment by olau%iol...@gtempaccount.com on 24 Jun 2011 at 9:57

GoogleCodeExporter commented 8 years ago
I will upload a complete filelist, that will reproduce the problem. I will take 
php for JSON response and html/javascript. That will take time. (1 day?)

Original comment by alexande...@googlemail.com on 24 Jun 2011 at 10:57

GoogleCodeExporter commented 8 years ago
By the way, an other work around is to add <meta http-equiv="X-UA-Compatible" 
content="IE=9" />, so that ie9 will run the problem in ie9 mode.

Original comment by alexande...@googlemail.com on 24 Jun 2011 at 10:59

GoogleCodeExporter commented 8 years ago
Ah, no, you need to make a small as possible example that demonstrates there is 
a problem in Flot (e.g. you could start off with the basic.html example and 
modify it slightly until the problem shows up). If there's a problem in your 
code, please don't post here - try the forum/mailing list instead.

However, that said, I think your problem might be that your data array is 
invalid. Perhaps you have an extraneous comma at the end of it? Like "[[...], 
[...],]" where the last comma is invalid. IE didn't use to like this, maybe 
they fixed that in IE 9 and now only barf in compatibility mode.

Original comment by olau%iol...@gtempaccount.com on 24 Jun 2011 at 11:20

GoogleCodeExporter commented 8 years ago
Sorry, for reporting this very late. I tested it as you say ... and your are 
right. IE does not like "," at the end of the array therefor the for loop 
increases one step to for thinking there is an element in the array. I think we 
can close this...

Original comment by alexande...@googlemail.com on 11 Jul 2011 at 9:01

GoogleCodeExporter commented 8 years ago
therefor I do not think upload is needed ...

Original comment by alexande...@googlemail.com on 11 Jul 2011 at 9:03

GoogleCodeExporter commented 8 years ago
I do think it would be good to somehow have it throw an error explaining to 
check the data code for trailing commas

Original comment by littlefr...@gmail.com on 10 Aug 2011 at 7:22

GoogleCodeExporter commented 8 years ago
Closing; it's not strictly a bug, and I don't think it's worth adding extra 
code (and therefore confusion) to check every incoming array for this case.

Original comment by dnsch...@gmail.com on 5 May 2012 at 1:25