From 9db8580b975a04e5aa87f668a2dd340331a9175f Mon Sep 17 00:00:00 2001 From: Niklas von Hertzen Date: Thu, 7 Dec 2017 16:12:39 +0800 Subject: [PATCH] Fix data-html2canvas-ignore attribute (Fix #1253) --- CHANGELOG.md | 1 + src/Clone.js | 5 +++- tests/reftests/options/ignore.html | 41 ++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 tests/reftests/options/ignore.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 0272d3a..ca03588 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ### Changelog ### #### v1.0.0-alpha2 - TBD #### + * Fix `data-html2canvas-ignore` attribute * Fix decimal `letter-spacing` values #### v1.0.0-alpha1 - 5.12.2017 #### diff --git a/src/Clone.js b/src/Clone.js index cdc1ff8..c60cc14 100644 --- a/src/Clone.js +++ b/src/Clone.js @@ -233,7 +233,10 @@ export class DocumentCloner { } for (let child = node.firstChild; child; child = child.nextSibling) { - if (child.nodeType !== Node.ELEMENT_NODE || child.nodeName !== 'SCRIPT') { + if ( + child.nodeType !== Node.ELEMENT_NODE || + (child.nodeName !== 'SCRIPT' && !child.hasAttribute('data-html2canvas-ignore')) + ) { if (!this.copyStyles || child.nodeName !== 'STYLE') { clone.appendChild(this.cloneNode(child)); } diff --git a/tests/reftests/options/ignore.html b/tests/reftests/options/ignore.html new file mode 100644 index 0000000..1280818 --- /dev/null +++ b/tests/reftests/options/ignore.html @@ -0,0 +1,41 @@ + + + + element render test + + + + + + + +
+ great failure +
+
+ great success +
+ + + +