mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Fix empty content getting rendered on firefox/IE
This commit is contained in:
parent
2b0db917e3
commit
3032dc6ce0
@ -271,10 +271,13 @@ _html2canvas.Preload = function( options ) {
|
|||||||
.forEach(removePseudoElements);
|
.forEach(removePseudoElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function indexedProperty(property) {
|
||||||
|
return (!isNaN(window.parseInt(property, 10)));
|
||||||
|
}
|
||||||
|
|
||||||
function getPseudoElement(el, which) {
|
function getPseudoElement(el, which) {
|
||||||
var elStyle = window.getComputedStyle(el, which);
|
var elStyle = window.getComputedStyle(el, which);
|
||||||
if(!elStyle || !elStyle.content) { return; }
|
if(!elStyle || !elStyle.content || elStyle.content === "none") { return; }
|
||||||
|
|
||||||
var content = elStyle.content + '',
|
var content = elStyle.content + '',
|
||||||
first = content.substr( 0, 1 );
|
first = content.substr( 0, 1 );
|
||||||
//strips quotes
|
//strips quotes
|
||||||
@ -286,9 +289,7 @@ _html2canvas.Preload = function( options ) {
|
|||||||
elps = document.createElement( isImage ? 'img' : 'span' );
|
elps = document.createElement( isImage ? 'img' : 'span' );
|
||||||
|
|
||||||
elps.className = '__html2canvas__' + which.substr(1);
|
elps.className = '__html2canvas__' + which.substr(1);
|
||||||
Object.keys(elStyle).forEach(function(prop) {
|
Object.keys(elStyle).filter(indexedProperty).forEach(function(prop) {
|
||||||
//skip indexed properties
|
|
||||||
if(!isNaN(parseInt(prop, 10))) { return; }
|
|
||||||
elps.style[prop] = elStyle[prop];
|
elps.style[prop] = elStyle[prop];
|
||||||
});
|
});
|
||||||
if(isImage) {
|
if(isImage) {
|
||||||
|
Loading…
Reference in New Issue
Block a user