mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
commit
097a4e58d7
15
src/Core.js
15
src/Core.js
@ -36,8 +36,6 @@ html2canvas.Util.backgroundImage = function (src) {
|
||||
};
|
||||
|
||||
html2canvas.Util.Bounds = function getBounds (el) {
|
||||
|
||||
window.scroll(0,0);
|
||||
var clientRect,
|
||||
bounds = {};
|
||||
|
||||
@ -109,9 +107,9 @@ html2canvas.Util.getCSS = function (el, attribute) {
|
||||
if ( rsLeft ) {
|
||||
el.runtimeStyle.left = rsLeft;
|
||||
}*/
|
||||
val = $(el).css(attribute);
|
||||
// val = $(el).css(attribute);
|
||||
// }
|
||||
return val;
|
||||
return $(el).css(attribute);
|
||||
|
||||
|
||||
};
|
||||
@ -128,5 +126,12 @@ html2canvas.Util.Extend = function (options, defaults) {
|
||||
|
||||
html2canvas.Util.Children = function(el) {
|
||||
// $(el).contents() !== el.childNodes, Opera / IE have issues with that
|
||||
return $(el).contents();
|
||||
var children;
|
||||
try {
|
||||
children = $(el).contents();
|
||||
} catch (ex) {
|
||||
html2canvas.log("html2canvas.Util.Children failed with exception: " + ex.message);
|
||||
children = [];
|
||||
}
|
||||
return children;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
html2canvas.Parse = function (element, images, opts) {
|
||||
|
||||
window.scroll(0,0);
|
||||
opts = opts || {};
|
||||
|
||||
// select body by default
|
||||
@ -175,14 +175,14 @@ html2canvas.Parse = function (element, images, opts) {
|
||||
|
||||
|
||||
|
||||
|
||||
// TODO add another image
|
||||
img.src = "http://html2canvas.hertzen.com/images/8.jpg";
|
||||
// http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ever (handtinywhite.gif)
|
||||
img.src = "data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACwAAAAAAQABAAACAkQBADs=";
|
||||
img.width = 1;
|
||||
img.height = 1;
|
||||
|
||||
img.style.margin = 0;
|
||||
img.style.padding = 0;
|
||||
img.style.verticalAlign = "baseline";
|
||||
|
||||
span.style.fontFamily = font;
|
||||
span.style.fontSize = fontSize;
|
||||
|
@ -156,7 +156,8 @@ html2canvas.Preload = function(element, opts){
|
||||
contentsLen = contents.length,
|
||||
background_image,
|
||||
src,
|
||||
img;
|
||||
img,
|
||||
elNodeType = false;
|
||||
|
||||
for (i = 0; i < contentsLen; i+=1 ){
|
||||
// var ignRe = new RegExp("("+this.ignoreElements+")");
|
||||
@ -166,8 +167,14 @@ html2canvas.Preload = function(element, opts){
|
||||
}
|
||||
|
||||
// }
|
||||
try {
|
||||
elNodeType = el.nodeType;
|
||||
} catch (ex) {
|
||||
elNodeType = false;
|
||||
html2canvas.log("html2canvas: failed to access some element's nodeType - Exception: " + ex.message);
|
||||
}
|
||||
|
||||
if (el.nodeType === 1 || el.nodeType === undefined){
|
||||
if (elNodeType === 1 || elNodeType === undefined){
|
||||
|
||||
background_image = html2canvas.Util.getCSS(el, 'backgroundImage');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user