Fix empty content getting rendered on firefox/IE

This commit is contained in:
Niklas von Hertzen 2013-01-11 19:31:05 +02:00
parent 2b0db917e3
commit 3032dc6ce0

View File

@ -271,10 +271,13 @@ _html2canvas.Preload = function( options ) {
.forEach(removePseudoElements);
}
function indexedProperty(property) {
return (!isNaN(window.parseInt(property, 10)));
}
function getPseudoElement(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 + '',
first = content.substr( 0, 1 );
//strips quotes
@ -286,9 +289,7 @@ _html2canvas.Preload = function( options ) {
elps = document.createElement( isImage ? 'img' : 'span' );
elps.className = '__html2canvas__' + which.substr(1);
Object.keys(elStyle).forEach(function(prop) {
//skip indexed properties
if(!isNaN(parseInt(prop, 10))) { return; }
Object.keys(elStyle).filter(indexedProperty).forEach(function(prop) {
elps.style[prop] = elStyle[prop];
});
if(isImage) {