Skip to content

Commit

Permalink
fixed for IE/Chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
kuna committed Apr 28, 2015
1 parent bce69aa commit 2e94373
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion dist/html2canvas.js
Expand Up @@ -2660,10 +2660,14 @@ NodeContainer.prototype.parseBackgroundPosition = function(bounds, image, index,
}
}

var position = this.css('backgroundPosition').match(/calc\([^\)]*\)|(\w|\%|\-)+/g);
var position = this.css('backgroundPosition').match(/(right|left|top|bottom) (\w|\%|\-)+|calc\([^\)]*\)|(\w|\%|\-)+/g);
var left=0, top=0;
var position_arr, i;

// interpret for IE/Chrome
position[0] = position[0].replace('right ', 'calc(100% + -').replace('left ', 'calc(0% + ');
position[1] = position[1].replace('bottom ', 'calc(100% + -').replace('top ', 'calc(0% + ');

// calculate calc
if (position[0].indexOf('calc') === 0) {
position_arr = position[0].replace(/calc|\(|\)|\s/g, '').split('+');
Expand Down

0 comments on commit 2e94373

Please sign in to comment.