- Linting (ESLint): Apply coding standards

- Breaking change (minor): Change export filename to check `exportWindowName` and change default from `download.pdf` to `svg.pdf` to distinguish from other downloads
- Enhancement: Restore old dataURI functionality for non-Chrome browsers
This commit is contained in:
Brett Zamir
2018-09-13 09:13:05 +08:00
parent 1e9b72ef53
commit b0bad24645
3 changed files with 27 additions and 12 deletions

View File

@@ -181,17 +181,17 @@ const svgElementToPdf = function (element, pdf, options) {
const getWidth = (node) => {
let box;
try{
box = node.getBBox(); //Firefox on MacOS will raise error here
}catch(err){
//copy and append to body so that getBBox is available
let nodeCopy = node.cloneNode(true);
let svg = node.ownerSVGElement.cloneNode(false);
try {
box = node.getBBox(); // Firefox on MacOS will raise error here
} catch (err) {
// copy and append to body so that getBBox is available
const nodeCopy = node.cloneNode(true);
const svg = node.ownerSVGElement.cloneNode(false);
svg.appendChild(nodeCopy);
document.body.appendChild(svg);
try{
try {
box = nodeCopy.getBBox();
}catch(err){
} catch (err) {
box = {width: 0};
}
document.body.removeChild(svg);