mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Disable animations on rendered page
This commit is contained in:
parent
444869e3ca
commit
199685ebd1
13
dist/html2canvas.js
vendored
13
dist/html2canvas.js
vendored
@ -1568,6 +1568,7 @@ function NodeParser(element, renderer, support, imageLoader, options) {
|
||||
}
|
||||
parent.visibile = parent.isElementVisible();
|
||||
this.createPseudoHideStyles(element.ownerDocument);
|
||||
this.disableAnimations(element.ownerDocument);
|
||||
this.nodes = flatten([parent].concat(this.getChildren(parent)).filter(function(container) {
|
||||
return container.visible = container.isElementVisible();
|
||||
}).map(this.getPseudoElements, this));
|
||||
@ -1649,9 +1650,17 @@ NodeParser.prototype.asyncRenderer = function(queue, resolve, asyncTimer) {
|
||||
};
|
||||
|
||||
NodeParser.prototype.createPseudoHideStyles = function(document) {
|
||||
this.createStyles(document, '.' + PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + ':before { content: "" !important; display: none !important; }' +
|
||||
'.' + PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER + ':after { content: "" !important; display: none !important; }');
|
||||
};
|
||||
|
||||
NodeParser.prototype.disableAnimations = function(document) {
|
||||
this.createStyles(document, '* { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; animation: none !important; }');
|
||||
};
|
||||
|
||||
NodeParser.prototype.createStyles = function(document, styles) {
|
||||
var hidePseudoElements = document.createElement('style');
|
||||
hidePseudoElements.innerHTML = '.' + PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + ':before { content: "" !important; display: none !important; }' +
|
||||
'.' + PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER + ':after { content: "" !important; display: none !important; }';
|
||||
hidePseudoElements.innerHTML = styles;
|
||||
document.body.appendChild(hidePseudoElements);
|
||||
};
|
||||
|
||||
|
4
dist/html2canvas.min.js
vendored
4
dist/html2canvas.min.js
vendored
File diff suppressed because one or more lines are too long
@ -14,6 +14,7 @@ function NodeParser(element, renderer, support, imageLoader, options) {
|
||||
}
|
||||
parent.visibile = parent.isElementVisible();
|
||||
this.createPseudoHideStyles(element.ownerDocument);
|
||||
this.disableAnimations(element.ownerDocument);
|
||||
this.nodes = flatten([parent].concat(this.getChildren(parent)).filter(function(container) {
|
||||
return container.visible = container.isElementVisible();
|
||||
}).map(this.getPseudoElements, this));
|
||||
@ -95,9 +96,17 @@ NodeParser.prototype.asyncRenderer = function(queue, resolve, asyncTimer) {
|
||||
};
|
||||
|
||||
NodeParser.prototype.createPseudoHideStyles = function(document) {
|
||||
this.createStyles(document, '.' + PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + ':before { content: "" !important; display: none !important; }' +
|
||||
'.' + PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER + ':after { content: "" !important; display: none !important; }');
|
||||
};
|
||||
|
||||
NodeParser.prototype.disableAnimations = function(document) {
|
||||
this.createStyles(document, '* { -webkit-animation: none !important; -moz-animation: none !important; -o-animation: none !important; animation: none !important; }');
|
||||
};
|
||||
|
||||
NodeParser.prototype.createStyles = function(document, styles) {
|
||||
var hidePseudoElements = document.createElement('style');
|
||||
hidePseudoElements.innerHTML = '.' + PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + ':before { content: "" !important; display: none !important; }' +
|
||||
'.' + PseudoElementContainer.prototype.PSEUDO_HIDE_ELEMENT_CLASS_AFTER + ':after { content: "" !important; display: none !important; }';
|
||||
hidePseudoElements.innerHTML = styles;
|
||||
document.body.appendChild(hidePseudoElements);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user