diff --git a/NEWS.txt b/NEWS.txt index 99fce1a..5c732fe 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -111,7 +111,9 @@ Bug fixes: - Listen for mouseleave events and fire a plothover event with empty item when it occurs to drop highlights when the mouse leaves the plot (reported by by outspirit). -- Fix bug with using aboveData with a background (reported by amitayd). +- Fix bug with using aboveData with a background (reported by + amitayd). +- Fix possible excanvas leak (report and suggested fix by tom9729). Flot 0.6 diff --git a/jquery.flot.js b/jquery.flot.js index 5251c10..755efcf 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -699,15 +699,28 @@ function constructCanvas() { canvasWidth = placeholder.width(); canvasHeight = placeholder.height(); + + // excanvas hack, if there are any canvases here, whack + // the state on them manually + if (window.G_vmlCanvasManager) + placeholder.find("canvas").each(function () { + delete this.context_; + }); + placeholder.html(""); // clear placeholder + if (placeholder.css("position") == 'static') placeholder.css("position", "relative"); // for positioning labels and overlay if (canvasWidth <= 0 || canvasHeight <= 0) throw "Invalid dimensions for plot, width = " + canvasWidth + ", height = " + canvasHeight; - if (window.G_vmlCanvasManager) // excanvas hack, make sure everything is setup + // excanvas hack, make sure everything is setup + if (window.G_vmlCanvasManager + && !window.G_vmlCanvasManager.inited) { + window.G_vmlCanvasManager.inited = true; window.G_vmlCanvasManager.init_(document); + } function makeCanvas(skipPositioning) { var c = document.createElement('canvas');