@@ -316,10 +316,9 @@ _html2canvas.Parse = function (images, options) {
316316
317317 function setZ ( element , stack , parentStack ) {
318318 var newContext ,
319- position = stack . cssPosition ,
320- zIndex = getCSS ( element , 'zIndex' ) ,
319+ isPositioned = stack . cssPosition !== 'static' ,
320+ zIndex = isPositioned ? getCSS ( element , 'zIndex' ) : 'auto' , // z-index only applies to positioned elements.
321321 opacity = getCSS ( element , 'opacity' ) , // can't use stack.opacity because it's blended
322- isPositioned = position !== 'static' ,
323322 isFloated = getCSS ( element , 'cssFloat' ) !== 'none' ;
324323
325324 // https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context
@@ -329,15 +328,11 @@ _html2canvas.Parse = function (images, options) {
329328 // elements with an opacity value less than 1. (See the specification for opacity),
330329 // on mobile WebKit and Chrome 22+, position: fixed always creates a new stacking context, even when z-index is "auto" (See this post)
331330
332- // z-index only applies to positioned elements.
333- // however, firefox may return the value set in CSS even if it's not positioned
334- if ( ! isPositioned ) { zIndex = 0 ; }
335331 stack . zIndex = newContext = h2czContext ( zIndex ) ;
336332 newContext . isPositioned = isPositioned ;
337333 newContext . isFloated = isFloated ;
338334
339- if ( ! parentStack || ( zIndex !== 'auto' && isPositioned ) ||
340- ( opacity && Number ( opacity ) < 1 ) ) {
335+ if ( zIndex !== 'auto' || opacity < 1 ) {
341336 newContext . ownStacking = true ;
342337 }
343338
@@ -967,7 +962,6 @@ _html2canvas.Parse = function (images, options) {
967962
968963 var ctx = h2cRenderContext ( ( ! parentStack ) ? documentWidth ( ) : bounds . width , ( ! parentStack ) ? documentHeight ( ) : bounds . height ) ,
969964 stack = {
970- el : element , // very useful when debugging
971965 ctx : ctx ,
972966 opacity : setOpacity ( ctx , element , parentStack ) ,
973967 cssPosition : getCSS ( element , "position" ) ,
0 commit comments