if (typeof (Blob) !== "undefined" && !!new Blob()) {
//alert("blob");
var imgData = img.replace(/^data:[a-z\/]*;base64,/, ''); // This line needs the \ added to the regexp
var byteString = atob(imgData);
var buffer = new ArrayBuffer(byteString.length);
Having a separator inside a grouping is undefined, and may or may not work. Adding the backslash fixes it right up.
This is line 1560 of canvasjs.js