passes z-index8 non-positioned element with opactiy < 1

The MDN article Understanding_z_index/Stacking_and_float is wrong about this
This commit is contained in:
arrix 2013-08-06 10:34:13 +08:00
parent 65746bd2e3
commit 02ab96dc5f
2 changed files with 6 additions and 3 deletions

View File

@ -331,6 +331,7 @@ _html2canvas.Parse = function (images, options) {
stack.zIndex = newContext = h2czContext(zIndex);
newContext.isPositioned = isPositioned;
newContext.isFloated = isFloated;
newContext.opacity = opacity;
if (zIndex !== 'auto' || opacity < 1) {
newContext.ownStacking = true;

View File

@ -48,10 +48,12 @@ _html2canvas.Renderer = function(parseQueue, options){
// positioned after static
context[zi].forEach(function(v) {
if (v.node.zIndex.isFloated) {
floated.push(v);
} else if (v.node.zIndex.isPositioned) {
if (v.node.zIndex.isPositioned || v.node.zIndex.opacity < 1) {
// http://www.w3.org/TR/css3-color/#transparency
// non-positioned element with opactiy < 1 should be stacked as if it were a positioned element with z-index: 0 and opacity: 1.
positioned.push(v);
} else if (v.node.zIndex.isFloated) {
floated.push(v);
} else {
nonPositioned.push(v);
}