1
0
mirror of https://github.com/niklasvh/html2canvas.git synced 2023-08-10 21:13:10 +03:00

Refactoring

This commit is contained in:
MoyuScript 2013-08-06 17:46:47 +03:00
parent ef7ffef87d
commit 25abef772e

@ -241,8 +241,7 @@ _html2canvas.Parse = function (images, options) {
}
function listItemText(element, type) {
var currentIndex = elementIndex(element),
text;
var currentIndex = elementIndex(element), text;
switch(type){
case "decimal":
text = currentIndex;
@ -264,8 +263,7 @@ _html2canvas.Parse = function (images, options) {
break;
}
text += ". ";
return text;
return text + ". ";
}
function renderListItem(element, stack, elBounds) {
@ -293,11 +291,7 @@ _html2canvas.Parse = function (images, options) {
function loadImage (src){
var img = images[src];
if (img && img.succeeded === true) {
return img.img;
} else {
return false;
}
return (img && img.succeeded === true) ? img.img : false;
}
function clipBounds(src, dst){
@ -317,8 +311,8 @@ _html2canvas.Parse = function (images, options) {
function setZ(element, stack, parentStack){
var newContext,
isPositioned = stack.cssPosition !== 'static',
zIndex = isPositioned ? getCSS(element, 'zIndex') : 'auto', // z-index only applies to positioned elements.
opacity = getCSS(element, 'opacity'), // can't use stack.opacity because it's blended
zIndex = isPositioned ? getCSS(element, 'zIndex') : 'auto',
opacity = getCSS(element, 'opacity'),
isFloated = getCSS(element, 'cssFloat') !== 'none';
// https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context
@ -332,10 +326,7 @@ _html2canvas.Parse = function (images, options) {
newContext.isPositioned = isPositioned;
newContext.isFloated = isFloated;
newContext.opacity = opacity;
if (zIndex !== 'auto' || opacity < 1) {
newContext.ownStacking = true;
}
newContext.ownStacking = (zIndex !== 'auto' || opacity < 1);
if (parentStack) {
parentStack.zIndex.children.push(stack);