app/assets/javascripts/highcharts/modules/exporting.js in highcharts-rails-5.0.0 vs app/assets/javascripts/highcharts/modules/exporting.js in highcharts-rails-5.0.3

- old
+ new

@@ -1,7 +1,7 @@ /** - * @license Highcharts JS v5.0.0 (2016-09-29) + * @license Highcharts JS v5.0.3 (2016-11-18) * Exporting module * * (c) 2010-2016 Torstein Honsi * * License: www.highcharts.com/license @@ -372,11 +372,13 @@ // Move HTML into a foreignObject if (allowHTML) { html = svg.match(/<\/svg>(.*?$)/); if (html) { - html = '<foreignObject x="0" y="0" width="200" height="200">' + + html = '<foreignObject x="0" y="0" ' + + 'width="' + sourceWidth + '" ' + + 'height="' + sourceHeight + '">' + '<body xmlns="http://www.w3.org/1999/xhtml">' + html[1] + '</body>' + '</foreignObject>'; svg = svg.replace('</svg>', html + '</svg>'); @@ -524,17 +526,12 @@ cacheName = 'cache-' + className, menu = chart[cacheName], menuPadding = Math.max(width, height), // for mouse leave detection innerMenu, hide, - hideTimer, menuStyle, - docMouseUpHandler = function(e) { - if (!chart.pointer.inClass(e.target, className)) { - hide(); - } - }; + removeMouseUp; // create the menu only the first time if (!menu) { // create a HTML element above the SVG @@ -570,22 +567,25 @@ chart.openMenu = false; }; // Hide the menu some time after mouse leave (#1357) addEvent(menu, 'mouseleave', function() { - hideTimer = setTimeout(hide, 500); + menu.hideTimer = setTimeout(hide, 500); }); addEvent(menu, 'mouseenter', function() { - clearTimeout(hideTimer); + clearTimeout(menu.hideTimer); }); - // Hide it on clicking or touching outside the menu (#2258, #2335, #2407) - addEvent(doc, 'mouseup', docMouseUpHandler); - addEvent(chart, 'destroy', function() { - removeEvent(doc, 'mouseup', docMouseUpHandler); + // Hide it on clicking or touching outside the menu (#2258, #2335, + // #2407) + removeMouseUp = addEvent(doc, 'mouseup', function(e) { + if (!chart.pointer.inClass(e.target, className)) { + hide(); + } }); + addEvent(chart, 'destroy', removeMouseUp); // create the items each(items, function(item) { if (item) { @@ -792,9 +792,10 @@ // Destroy the divs for the menu if (exportDivElements) { each(exportDivElements, function(elem, i) { // Remove the event handler + clearTimeout(elem.hideTimer); // #5427 removeEvent(elem, 'mouseleave'); // Remove inline events chart.exportDivElements[i] = elem.onmouseout = elem.onmouseover = elem.ontouchstart = elem.onclick = null;