mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Fix z-index ordering bug
This commit is contained in:
parent
443fd17a12
commit
46cc8b6975
@ -1,4 +1,13 @@
|
||||
_html2canvas.Renderer = function(parseQueue, options){
|
||||
function sortZindex(a, b) {
|
||||
if (a === 'children') {
|
||||
return -1;
|
||||
} else if (b === 'children') {
|
||||
return 1;
|
||||
} else {
|
||||
return a - b;
|
||||
}
|
||||
}
|
||||
|
||||
// http://www.w3.org/TR/CSS21/zindex.html
|
||||
function createRenderQueue(parseQueue) {
|
||||
@ -16,8 +25,9 @@ _html2canvas.Renderer = function(parseQueue, options){
|
||||
childrenDest = specialParent; // where children without z-index should be pushed into
|
||||
|
||||
if (node.zIndex.ownStacking) {
|
||||
// '!' comes before numbers in sorted array
|
||||
contextForChildren = stub.context = { '!': [{node:node, children: []}]};
|
||||
contextForChildren = stub.context = {
|
||||
children: [{node:node, children: []}]
|
||||
};
|
||||
childrenDest = undefined;
|
||||
} else if (isPositioned || isFloated) {
|
||||
childrenDest = stub.children = [];
|
||||
@ -39,7 +49,7 @@ _html2canvas.Renderer = function(parseQueue, options){
|
||||
})(parseQueue);
|
||||
|
||||
function sortZ(context) {
|
||||
Object.keys(context).sort(function(a, b) { return a - b; }).forEach(function(zi) {
|
||||
Object.keys(context).sort(sortZindex).forEach(function(zi) {
|
||||
var nonPositioned = [],
|
||||
floated = [],
|
||||
positioned = [],
|
||||
|
Loading…
Reference in New Issue
Block a user