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) {
|
html2canvas.Util.Bounds = function getBounds (el) {
|
||||||
|
|
||||||
window.scroll(0,0);
|
|
||||||
var clientRect,
|
var clientRect,
|
||||||
bounds = {};
|
bounds = {};
|
||||||
|
|
||||||
@ -109,9 +107,9 @@ html2canvas.Util.getCSS = function (el, attribute) {
|
|||||||
if ( rsLeft ) {
|
if ( rsLeft ) {
|
||||||
el.runtimeStyle.left = 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) {
|
html2canvas.Util.Children = function(el) {
|
||||||
// $(el).contents() !== el.childNodes, Opera / IE have issues with that
|
// $(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) {
|
html2canvas.Parse = function (element, images, opts) {
|
||||||
|
window.scroll(0,0);
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
|
||||||
// select body by default
|
// select body by default
|
||||||
@ -175,14 +175,14 @@ html2canvas.Parse = function (element, images, opts) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// http://probablyprogramming.com/2009/03/15/the-tiniest-gif-ever (handtinywhite.gif)
|
||||||
// TODO add another image
|
img.src = "data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACwAAAAAAQABAAACAkQBADs=";
|
||||||
img.src = "http://html2canvas.hertzen.com/images/8.jpg";
|
|
||||||
img.width = 1;
|
img.width = 1;
|
||||||
img.height = 1;
|
img.height = 1;
|
||||||
|
|
||||||
img.style.margin = 0;
|
img.style.margin = 0;
|
||||||
img.style.padding = 0;
|
img.style.padding = 0;
|
||||||
|
img.style.verticalAlign = "baseline";
|
||||||
|
|
||||||
span.style.fontFamily = font;
|
span.style.fontFamily = font;
|
||||||
span.style.fontSize = fontSize;
|
span.style.fontSize = fontSize;
|
||||||
|
@ -156,7 +156,8 @@ html2canvas.Preload = function(element, opts){
|
|||||||
contentsLen = contents.length,
|
contentsLen = contents.length,
|
||||||
background_image,
|
background_image,
|
||||||
src,
|
src,
|
||||||
img;
|
img,
|
||||||
|
elNodeType = false;
|
||||||
|
|
||||||
for (i = 0; i < contentsLen; i+=1 ){
|
for (i = 0; i < contentsLen; i+=1 ){
|
||||||
// var ignRe = new RegExp("("+this.ignoreElements+")");
|
// 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');
|
background_image = html2canvas.Util.getCSS(el, 'backgroundImage');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user