mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
IE11 Member not found fix Wrap accesing the cssText property in a try...catch (#1415)
* https://github.com/niklasvh/html2canvas/issues/1374 - Wrap accesing the cssText property in a try...catch
This commit is contained in:
parent
e6bbc1abb5
commit
0e273418c7
14
src/Clone.js
14
src/Clone.js
@ -230,9 +230,17 @@ export class DocumentCloner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (node instanceof HTMLStyleElement && node.sheet && node.sheet.cssRules) {
|
if (node instanceof HTMLStyleElement && node.sheet && node.sheet.cssRules) {
|
||||||
const css = [].slice
|
const css = [].slice.call(node.sheet.cssRules, 0).reduce((css, rule) => {
|
||||||
.call(node.sheet.cssRules, 0)
|
try {
|
||||||
.reduce((css, rule) => css + rule.cssText, '');
|
if (rule && rule.cssText) {
|
||||||
|
return css + rule.cssText;
|
||||||
|
}
|
||||||
|
return css;
|
||||||
|
} catch (err) {
|
||||||
|
this.logger.log('Unable to access cssText property', rule.name);
|
||||||
|
return css;
|
||||||
|
}
|
||||||
|
}, '');
|
||||||
const style = node.cloneNode(false);
|
const style = node.cloneNode(false);
|
||||||
style.textContent = css;
|
style.textContent = css;
|
||||||
return style;
|
return style;
|
||||||
|
Loading…
Reference in New Issue
Block a user