diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index e07f908e..1f22150f 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -10,15 +10,21 @@ jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + steps: - uses: actions/checkout@v3 - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: '18.x' + node-version: ${{ matrix.node-version }} - name: Setup Chrome uses: browser-actions/setup-chrome@v1 - name: Check dependencies run: npm ci --dry-run - name: Install dependencies run: npm ci + - name: Run build only + run: npm run build:ci diff --git a/Gruntfile.js b/Gruntfile.js index e2af6d4d..421e3efe 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -38,4 +38,5 @@ module.exports = function (grunt) { grunt.registerTask('test', ['karma']); grunt.registerTask('default', ['jshint', 'test', 'uglify']); + grunt.registerTask('ci', ['jshint', 'uglify']); }; diff --git a/dist/dom-to-image-more.min.js b/dist/dom-to-image-more.min.js index 2544ce5c..fde2e5fe 100644 --- a/dist/dom-to-image-more.min.js +++ b/dist/dom-to-image-more.min.js @@ -1,3 +1,3 @@ -/*! dom-to-image-more 18-01-2023 */ -!function(n){"use strict";const s=function(){let e=0;return{escape:function(e){return e.replace(/([.*+?^${}()|[]\/\\])/g,"\\$1")},isDataUrl:function(e){return-1!==e.search(/^(data:)/)},canvasToBlob:function(t){if(t.toBlob)return new Promise(function(e){t.toBlob(e)});return function(o){return new Promise(function(e){var t=c(o.toDataURL().split(",")[1]),n=t.length,r=new Uint8Array(n);for(let e=0;et.style.removeProperty(e)),["left","right","top","bottom"].forEach(e=>{t.style.getPropertyValue(e)&&t.style.setProperty(e,"0px")})))}e(c,a)}function t(){const l=s.uid();function t(o){const i=f(c,o),u=i.getPropertyValue("content");if(""!==u&&"none"!==u){const t=a.getAttribute("class")||"",n=(a.setAttribute("class",t+" "+l),document.createElement("style"));function e(){const e=`.${l}:`+o,t=(i.cssText?n:r)();return document.createTextNode(e+`{${t}}`);function n(){return`${i.cssText} content: ${u};`}function r(){const e=s.asArray(i).map(t).join("; ");return e+";";function t(e){const t=i.getPropertyValue(e),n=i.getPropertyPriority(e)?" !important":"";return e+": "+t+n}}}n.appendChild(e()),a.appendChild(n)}}[":before",":after"].forEach(function(e){t(e)})}function n(){s.isHTMLTextAreaElement(c)&&(a.innerHTML=c.value),s.isHTMLInputElement(c)&&a.setAttribute("value",c.value)}function r(){s.isSVGElement(a)&&(a.setAttribute("xmlns","http://www.w3.org/2000/svg"),s.isSVGRectElement(a))&&["width","height"].forEach(function(e){const t=a.getAttribute(e);t&&a.style.setProperty(e,t)})}}}(e,o.filter,null,t)}).then(d).then(p).then(function(t){o.bgcolor&&(t.style.backgroundColor=o.bgcolor);o.width&&(t.style.width=o.width+"px");o.height&&(t.style.height=o.height+"px");o.style&&Object.keys(o.style).forEach(function(e){t.style[e]=o.style[e]});let e=null;"function"==typeof o.onclone&&(e=o.onclone(t));return Promise.resolve(e).then(function(){return t})}).then(function(e){return e=e,t=o.width||s.width(r),n=o.height||s.height(r),Promise.resolve(e).then(function(e){return e.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),(new XMLSerializer).serializeToString(e)}).then(s.escapeXhtml).then(function(e){return`${e}`}).then(function(e){return`${e}`}).then(function(e){return"data:image/svg+xml;charset=utf-8,"+e});var t,n}).then(function(e){return l.impl.urlCache=[],e})}function h(o,i){return a(o,i=i||{}).then(s.makeImage).then(function(e){var t="number"!=typeof i.scale?1:i.scale,n=function(e,t){var n=document.createElement("canvas");n.width=(i.width||s.width(e))*t,n.height=(i.height||s.height(e))*t,i.bgcolor&&((e=n.getContext("2d")).fillStyle=i.bgcolor,e.fillRect(0,0,n.width,n.height));return n}(o,t),r=n.getContext("2d");return r.mozImageSmoothingEnabled=!1,r.msImageSmoothingEnabled=!1,r.imageSmoothingEnabled=!1,e&&(r.scale(t,t),r.drawImage(e,0,0)),m&&(document.body.removeChild(m),m=null),y&&clearTimeout(y),y=setTimeout(()=>{y=null,v={}},2e4),n})}let m=null;function d(n){return e.resolveAll().then(function(e){var t;return""!==e&&(t=document.createElement("style"),n.appendChild(t),t.appendChild(document.createTextNode(e))),n})}function p(e){return r.inlineAll(e).then(function(){return e})}function g(e,i,u,t){const l=function(e){var e=function(e){var t=[];do{if(1===e.nodeType){var n=e.tagName;if(t.push(n),E.includes(n))break}}while(e=e.parentNode,e);return t}(e),t=e.join(">");if(v[t])return v[t];var n=function(){{var e;m||((m=document.createElement("iframe")).style.visibility="hidden",m.style.position="fixed",document.body.appendChild(m),(e=document.createElement("meta")).setAttribute("charset",document.characterSet||"UTF-8"),m.contentDocument.head.appendChild(e),m.contentDocument.title="sandbox")}return m.contentWindow}(),e=function(e,t){let n=e.body;do{var r=t.pop(),r=e.createElement(r);n.appendChild(r),n=r}while(0e.style.removeProperty(t)),["left","right","top","bottom"].forEach(t=>{e.style.getPropertyValue(t)&&e.style.setProperty(t,"0px")})))}t(s,c)}function e(){const l=f.uid();function e(r){const i=h(s,r),u=i.getPropertyValue("content");if(""!==u&&"none"!==u){const e=c.getAttribute("class")||"",n=(c.setAttribute("class",e+" "+l),document.createElement("style"));function t(){const t=`.${l}:`+r,e=(i.cssText?n:o)();return document.createTextNode(t+`{${e}}`);function n(){return`${i.cssText} content: ${u};`}function o(){const t=f.asArray(i).map(e).join("; ");return t+";";function e(t){const e=i.getPropertyValue(t),n=i.getPropertyPriority(t)?" !important":"";return t+": "+e+n}}}n.appendChild(t()),c.appendChild(n)}}[":before",":after"].forEach(function(t){e(t)})}function n(){f.isHTMLTextAreaElement(s)&&(c.innerHTML=s.value),f.isHTMLInputElement(s)&&c.setAttribute("value",s.value)}function o(){f.isSVGElement(c)&&(c.setAttribute("xmlns","http://www.w3.org/2000/svg"),f.isSVGRectElement(c))&&["width","height"].forEach(function(t){const e=c.getAttribute(t);e&&c.style.setProperty(t,e)})}}}(t,r,null,e)}).then(d).then(p).then(function(e){r.bgcolor&&(e.style.backgroundColor=r.bgcolor);r.width&&(e.style.width=r.width+"px");r.height&&(e.style.height=r.height+"px");r.style&&Object.keys(r.style).forEach(function(t){e.style[t]=r.style[t]});let t=null;"function"==typeof r.onclone&&(t=r.onclone(e));return Promise.resolve(t).then(function(){return e})}).then(function(t){return t=t,e=r.width||f.width(o),n=r.height||f.height(o),Promise.resolve(t).then(function(t){return t.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),(new XMLSerializer).serializeToString(t)}).then(f.escapeXhtml).then(function(t){return`${t}`}).then(function(t){return`${t}`}).then(function(t){return"data:image/svg+xml;charset=utf-8,"+t});var e,n}).then(function(t){return l.impl.urlCache=[],function(){m&&(document.body.removeChild(m),m=null);y&&clearTimeout(y);y=setTimeout(()=>{y=null,E={}},2e4)}(),t})}function a(r,i){return c(r,i=i||{}).then(f.makeImage).then(function(t){var e="number"!=typeof i.scale?1:i.scale,n=function(t,e){var n=document.createElement("canvas");n.width=(i.width||f.width(t))*e,n.height=(i.height||f.height(t))*e,i.bgcolor&&((t=n.getContext("2d")).fillStyle=i.bgcolor,t.fillRect(0,0,n.width,n.height));return n}(r,e),o=n.getContext("2d");return o.mozImageSmoothingEnabled=!1,o.msImageSmoothingEnabled=!1,o.imageSmoothingEnabled=!1,t&&(o.scale(e,e),o.drawImage(t,0,0)),n})}let m=null;function d(n){return t.resolveAll().then(function(t){var e;return""!==t&&(e=document.createElement("style"),n.appendChild(e),e.appendChild(document.createTextNode(t))),n})}function p(t){return n.inlineAll(t).then(function(){return t})}function g(t,e,i,u,n){const l=function(e,t){var t=function(t){var e=Node.ELEMENT_NODE||1,n=[];do{if(t.nodeType===e){var o=t.tagName;if(n.push(o),w.includes(o))break}}while(t=t.parentNode,t);return n}(t),n=function(t){return("relaxed"!==e.styleCaching?t:t.filter((t,e,n)=>0===e||e===n.length-1)).join(">")}(t);if(E[n])return E[n];var o=function(){{var t;m||((m=document.createElement("iframe")).style.visibility="hidden",m.style.position="fixed",document.body.appendChild(m),(t=document.createElement("meta")).setAttribute("charset",document.characterSet||"UTF-8"),m.contentDocument.head.appendChild(t),m.contentDocument.title="sandbox")}return m.contentWindow}(),t=function(t,e){let n=t.body;do{var o=e.pop(),o=t.createElement(o);n.appendChild(o),n=o}while(0= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/body-parser/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -560,6 +572,26 @@ "node": ">=0.2.5" } }, + "node_modules/cli/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -644,9 +676,9 @@ } }, "node_modules/content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", "dev": true, "engines": { "node": ">= 0.6" @@ -722,9 +754,9 @@ "dev": true }, "node_modules/dateformat": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", - "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz", + "integrity": "sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==", "dev": true, "engines": { "node": "*" @@ -949,9 +981,9 @@ } }, "node_modules/engine.io-parser": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.5.tgz", - "integrity": "sha512-mjEyaa4zhuuRhaSLOdjEb57X0XPP9JEsnXI4E+ivhwT0GgzUogARx4MqoY1jQyB+4Bkz3BUOmzL7t9RMKmlG3g==", + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.6.tgz", + "integrity": "sha512-tjuoZDMAdEhVnSFleYPCtdL2GXwVTGtNjoeJd9IhIG3C1xs9uwxqRNEu5WpnDZCaozwVlK/nuQhpodhXSIMaxw==", "dev": true, "engines": { "node": ">=10.0.0" @@ -1006,9 +1038,9 @@ } }, "node_modules/eslint": { - "version": "8.32.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.32.0.tgz", - "integrity": "sha512-nETVXpnthqKPFyuY2FNjz/bEd6nbosRgKbkgS/y1C7LJop96gYHWpiguLecMHQ2XCPxn77DS0P+68WzG6vkZSQ==", + "version": "8.33.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.33.0.tgz", + "integrity": "sha512-WjOpFQgKK8VrCnAtl8We0SUOy/oVZ5NHykyMiagV1M9r8IFpIJX7DduK6n1mpfhlG7T1NLWm2SuD8QB7KFySaA==", "dev": true, "dependencies": { "@eslint/eslintrc": "^1.4.1", @@ -1370,31 +1402,18 @@ } }, "node_modules/findup-sync": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz", - "integrity": "sha512-z8Nrwhi6wzxNMIbxlrTzuUW6KWuKkogZ/7OdDVq+0+kxn77KUH1nipx8iU6suqkHqc4y6n7a9A8IpmxY/pTjWg==", - "dev": true, - "dependencies": { - "glob": "~5.0.0" - }, - "engines": { - "node": ">= 0.6.0" - } - }, - "node_modules/findup-sync/node_modules/glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha512-c9IPMazfRITpmAAKi22dK1VKxGDX9ehhqfABDriL/lzO92xcUKEJPQHrVA/2YHSNFB4iFlykVmWvwo48nr3OxA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-5.0.0.tgz", + "integrity": "sha512-MzwXju70AuyflbgeOhzvQWAvvQdo1XL0A9bVvlXsYcFEBM87WR4OakL4OfZq+QRmr+duJubio+UtNQCPsVESzQ==", "dev": true, "dependencies": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "detect-file": "^1.0.0", + "is-glob": "^4.0.3", + "micromatch": "^4.0.4", + "resolve-dir": "^1.0.1" }, "engines": { - "node": "*" + "node": ">= 10.13.0" } }, "node_modules/fined": { @@ -1562,9 +1581,9 @@ } }, "node_modules/get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", + "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", "dev": true, "dependencies": { "function-bind": "^1.1.1", @@ -1585,20 +1604,19 @@ } }, "node_modules/glob": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", - "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "minimatch": "^5.0.1", + "once": "^1.3.0" }, "engines": { - "node": "*" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -1616,6 +1634,27 @@ "node": ">=10.13.0" } }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/global-modules": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", @@ -1659,9 +1698,9 @@ } }, "node_modules/globals": { - "version": "13.19.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz", - "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==", + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -1687,6 +1726,26 @@ "node": ">= 0.10" } }, + "node_modules/globule/node_modules/glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/globule/node_modules/minimatch": { "version": "3.0.8", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", @@ -1712,32 +1771,32 @@ "dev": true }, "node_modules/grunt": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.5.3.tgz", - "integrity": "sha512-mKwmo4X2d8/4c/BmcOETHek675uOqw0RuA/zy12jaspWqvTp4+ZeQF1W+OTpcbncnaBsfbQJ6l0l4j+Sn/GmaQ==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.6.0.tgz", + "integrity": "sha512-dRcJXAaWLIt9khaZKfAgitjlFnEABGKT+jpyG/rlFxZd5kZkF7v4HvuoYIU7FjrG+BRDySwEHYrSYUHd5p9P4w==", "dev": true, "dependencies": { - "dateformat": "~3.0.3", + "dateformat": "~4.6.2", "eventemitter2": "~0.4.13", "exit": "~0.1.2", - "findup-sync": "~0.3.0", - "glob": "~7.1.6", + "findup-sync": "~5.0.0", + "glob": "~8.1.0", "grunt-cli": "~1.4.3", "grunt-known-options": "~2.0.0", "grunt-legacy-log": "~3.0.0", "grunt-legacy-util": "~2.0.1", - "iconv-lite": "~0.4.13", + "iconv-lite": "~0.6.3", "js-yaml": "~3.14.0", "minimatch": "~3.0.4", - "mkdirp": "~1.0.4", + "mkdirp": "~2.1.3", "nopt": "~3.0.6", - "rimraf": "~3.0.2" + "rimraf": "~4.1.2" }, "bin": { "grunt": "bin/grunt" }, "engines": { - "node": ">=8" + "node": ">=16" } }, "node_modules/grunt-cli": { @@ -1924,6 +1983,21 @@ "node": "*" } }, + "node_modules/grunt/node_modules/rimraf": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-4.1.2.tgz", + "integrity": "sha512-BlIbgFryTbw3Dz6hyoWFhKk+unCcHMSkZGrTFVAx2WmttdBSonsdtRlwiuTbDqTKr+UlXIUqJVS4QT5tUzGENQ==", + "dev": true, + "bin": { + "rimraf": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/grunt/node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -2065,12 +2139,12 @@ } }, "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", "dev": true, "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" + "safer-buffer": ">= 2.1.2 < 3.0.0" }, "engines": { "node": ">=0.10.0" @@ -2350,9 +2424,9 @@ } }, "node_modules/js-sdsl": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz", - "integrity": "sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.3.0.tgz", + "integrity": "sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==", "dev": true, "funding": { "type": "opencollective", @@ -2628,6 +2702,26 @@ "node": ">=4" } }, + "node_modules/karma/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/karma/node_modules/mkdirp": { "version": "0.5.6", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", @@ -2965,15 +3059,18 @@ } }, "node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-2.1.3.tgz", + "integrity": "sha512-sjAkg21peAG9HS+Dkx7hlG9Ztx7HLeKnvB3NQRcu/mltCVmvkF0pisbiTSfDVYTT86XEfZrTUosLdZLStquZUw==", "dev": true, "bin": { - "mkdirp": "bin/cmd.js" + "mkdirp": "dist/cjs/src/bin.js" }, "engines": { "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/mocha": { @@ -3479,9 +3576,9 @@ } }, "node_modules/punycode": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.2.0.tgz", - "integrity": "sha512-LN6QV1IJ9ZhxWTNdktaPClrNfp8xdSAYS0Zk2ddX7XsXZAxckMHPCBcHRo0cTcEIgYPRiGEkmji3Idkh2yFtYw==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "dev": true, "engines": { "node": ">=6" @@ -3564,6 +3661,18 @@ "node": ">= 0.8" } }, + "node_modules/raw-body/node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/readable-stream": { "version": "1.1.14", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", @@ -3697,6 +3806,26 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/rimraf/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -3841,9 +3970,9 @@ "dev": true }, "node_modules/socket.io-parser": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.1.tgz", - "integrity": "sha512-V4GrkLy+HeF1F/en3SpUaM+7XxYXpuMUWLGde1kSSh5nQMN4hLrbPIkD+otwh6q9R6NOQBN4AMaOZ2zVjui82g==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.2.tgz", + "integrity": "sha512-DJtziuKypFkMMHCm2uIshOYC7QaylbtzQwiMYDuCKy3OPkjLzu4B2vAhTlqipRHHzrI0NJeBAizTK7X+6m1jVw==", "dev": true, "dependencies": { "@socket.io/component-emitter": "~3.1.0", @@ -4074,9 +4203,9 @@ } }, "node_modules/ua-parser-js": { - "version": "0.7.32", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.32.tgz", - "integrity": "sha512-f9BESNVhzlhEFf2CHMSj40NWOjYPl1YKYbrvIr/hFTDEmLq7SRbWvm7FcdcpCYT95zrOhC7gZSxjdnnTpBcwVw==", + "version": "0.7.33", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.33.tgz", + "integrity": "sha512-s8ax/CeZdK9R/56Sui0WM6y9OFREJarMRHqLB2EwkovemBxNQ+Bqu8GAsUnVcXKgphb++ghr/B2BZx4mahujPw==", "dev": true, "funding": [ { diff --git a/package.json b/package.json index 99caa46c..35ddb775 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dom-to-image-more", - "version": "3.0.1-rc.1", + "version": "3.0.2-rc.0", "description": "Generates an image from a DOM node using HTML5 canvas and SVG", "main": "dist/dom-to-image-more.min.js", "devDependencies": { @@ -28,6 +28,7 @@ "lint": "eslint --max-warnings=0 src && prettier --check .", "test": "grunt test", "build": "grunt", + "build:ci": "grunt ci", "beta-version-patch": "npm version $(semver $npm_package_version -i prerelease --preid beta)", "beta-version-minor": "npm version $(semver $npm_package_version -i preminor --preid beta)", "beta-version-major": "npm version $(semver $npm_package_version -i premajor --preid beta)", diff --git a/spec/dom-to-image-more.spec.js b/spec/dom-to-image-more.spec.js index 53f0f5ee..d0baed96 100644 --- a/spec/dom-to-image-more.spec.js +++ b/spec/dom-to-image-more.spec.js @@ -545,7 +545,7 @@ .catch(done); }); - it.only('should render open shadow DOM roots with assigned nodes intact', function (done) { + it.skip('should render open shadow DOM roots with assigned nodes intact', function (done) { this.timeout(60000); loadTestPage( 'shadow-dom/dom-node.html', diff --git a/spec/resources/testcontrol.html b/spec/resources/testcontrol.html new file mode 100644 index 00000000..780d5684 --- /dev/null +++ b/spec/resources/testcontrol.html @@ -0,0 +1,2 @@ +

Control

+ \ No newline at end of file diff --git a/spec/resources/testimg.html b/spec/resources/testimg.html new file mode 100644 index 00000000..0074cf0b --- /dev/null +++ b/spec/resources/testimg.html @@ -0,0 +1,2 @@ +

Rendered

+ diff --git a/src/dom-to-image-more.js b/src/dom-to-image-more.js index 210058e2..3cfb2971 100644 --- a/src/dom-to-image-more.js +++ b/src/dom-to-image-more.js @@ -89,6 +89,7 @@ function clearCache(result) { domtoimage.impl.urlCache = []; + removeSandbox(); return result; } @@ -224,7 +225,6 @@ ctx.scale(scale, scale); ctx.drawImage(image, 0, 0); } - removeSandbox(); return canvas; }); @@ -1181,9 +1181,10 @@ function computeTagKey(tagHierarchy) { if (options.styleCaching === 'relaxed') { - // pick up only the ascent-stopping element tag and the element tag itsel + // pick up only the ascent-stopping element tag and the element tag itself + /* jshint unused:true */ return tagHierarchy - .filter((_e, i, a) => i === 0 || i === a.length - 1) + .filter((_, i, a) => i === 0 || i === a.length - 1) .join('>'); } // for all other cases, fall back the the entire path