_html2canvas.Util.Support = function (options, doc) { function supportSVGRendering() { var img = new Image(), canvas = doc.createElement("canvas"), ctx = (canvas.getContext === undefined) ? false : canvas.getContext("2d"); if (ctx === false) { return false; } canvas.width = canvas.height = 10; img.src = [ "data:image/svg+xml,", "", "", "
", "sup", "
", "
", "
" ].join(""); try { ctx.drawImage(img, 0, 0); canvas.toDataURL(); } catch(e) { return false; } h2clog('html2canvas: Parse: SVG powered rendering available'); return true; } // Test whether we can use ranges to measure bounding boxes // Opera doesn't provide valid bounds.height/bottom even though it supports the method. function supportRangeBounds() { var r, testElement, rangeBounds, rangeHeight, support = false; if (doc.createRange) { r = doc.createRange(); if (r.getBoundingClientRect) { testElement = doc.createElement('boundtest'); testElement.style.height = "123px"; testElement.style.display = "block"; doc.body.appendChild(testElement); r.selectNode(testElement); rangeBounds = r.getBoundingClientRect(); rangeHeight = rangeBounds.height; if (rangeHeight === 123) { support = true; } doc.body.removeChild(testElement); } } return support; } return { rangeBounds: supportRangeBounds(), svgRendering: options.svgRendering && supportSVGRendering() }; };