diff --git a/src/Renderer.js b/src/Renderer.js
index d1c650e..91a2eab 100644
--- a/src/Renderer.js
+++ b/src/Renderer.js
@@ -15,12 +15,10 @@ _html2canvas.Renderer = function(parseQueue, options){
stub = {node: node},
childrenDest = specialParent; // where children without z-index should be pushed into
- if (!context[zi]) { context[zi] = []; }
if (node.zIndex.ownStacking) {
- contextForChildren = stub.context = { 0: [{node:node}]};
- if (isPositioned || isFloated) {
- childrenDest = contextForChildren[0][0].children = [];
- }
+ // '!' comes before numbers in sorted array
+ contextForChildren = stub.context = { '!': [{node:node, children: []}]};
+ childrenDest = undefined;
} else if (isPositioned || isFloated) {
childrenDest = stub.children = [];
}
@@ -28,6 +26,7 @@ _html2canvas.Renderer = function(parseQueue, options){
if (zi === 0 && specialParent) {
specialParent.push(stub);
} else {
+ if (!context[zi]) { context[zi] = []; }
context[zi].push(stub);
}
diff --git a/tests/cases/zindex/z-index10.html b/tests/cases/zindex/z-index10.html
index e931289..485d2e7 100644
--- a/tests/cases/zindex/z-index10.html
+++ b/tests/cases/zindex/z-index10.html
@@ -25,7 +25,7 @@
font-weight: bold;
}
#div1, #div2 {
- border: 1px dashed #696;
+ border: 1px solid #696;
padding: 10px;
background-color: #cfc;
}
@@ -43,12 +43,12 @@
top: 40px;
left: 180px;
width: 330px;
- border: 1px dashed #900;
+ border: 1px solid #900;
background-color: #fdd;
padding: 40px 20px 20px;
}
#div4, #div5 {
- border: 1px dashed #996;
+ border: 1px solid #996;
background-color: #ffc;
}
#div4 {
@@ -68,7 +68,7 @@
left: 180px;
width: 150px;
height: 125px;
- border: 1px dashed #009;
+ border: 1px solid #009;
padding-top: 125px;
background-color: #ddf;
text-align: center;
diff --git a/tests/cases/zindex/z-index13.html b/tests/cases/zindex/z-index13.html
new file mode 100644
index 0000000..884f792
--- /dev/null
+++ b/tests/cases/zindex/z-index13.html
@@ -0,0 +1,31 @@
+
+
+
+ text above children with negative z-index; z-index tests #13
+
+
+
+
+
+
+
+
diff --git a/tests/cases/zindex/z-index14.html b/tests/cases/zindex/z-index14.html
new file mode 100644
index 0000000..6bfa9c5
--- /dev/null
+++ b/tests/cases/zindex/z-index14.html
@@ -0,0 +1,25 @@
+
+
+
+ body text above children with negative index but body bgcolor below
+
+
+
+
+ body
+
+
+
diff --git a/tests/cases/zindex/z-index15.html b/tests/cases/zindex/z-index15.html
new file mode 100644
index 0000000..f8dbece
--- /dev/null
+++ b/tests/cases/zindex/z-index15.html
@@ -0,0 +1,26 @@
+
+
+
+ body text and bgcolor above children with negative z-index
+
+
+
+
+ body
+
+
+
diff --git a/tests/cases/zindex/z-index4.html b/tests/cases/zindex/z-index4.html
index d2f82c1..3e0b95b 100644
--- a/tests/cases/zindex/z-index4.html
+++ b/tests/cases/zindex/z-index4.html
@@ -9,7 +9,7 @@
width: 250px;
height: 70px;
position: relative;
- border: 2px outset #669966;
+ border: 2px solid #669966;
background-color: #ccffcc;
padding-left: 5px;
}
diff --git a/tests/cases/zindex/z-index7.html b/tests/cases/zindex/z-index7.html
index abb75fd..dae7f4a 100644
--- a/tests/cases/zindex/z-index7.html
+++ b/tests/cases/zindex/z-index7.html
@@ -15,7 +15,7 @@ span.bold { font-weight: bold; }
#normdiv {
height: 70px;
- border: 1px dashed #999966;
+ border: 1px solid #999966;
background-color: #ffffcc;
margin: 0px 50px 0px 50px;
text-align: center;
@@ -26,7 +26,7 @@ span.bold { font-weight: bold; }
height: 100px;
position: relative;
top: 30px;
- border: 1px dashed #669966;
+ border: 1px solid #669966;
background-color: #ccffcc;
margin: 0px 50px 0px 50px;
text-align: center;
@@ -38,7 +38,7 @@ span.bold { font-weight: bold; }
position: relative;
top: 15px;
left: 20px;
- border: 1px dashed #669966;
+ border: 1px solid #669966;
background-color: #ccffcc;
margin: 0px 50px 0px 50px;
text-align: center;
@@ -51,7 +51,7 @@ span.bold { font-weight: bold; }
height: 350px;
top: 10px;
left: 10px;
- border: 1px dashed #990000;
+ border: 1px solid #990000;
background-color: #ffdddd;
text-align: center;
}
@@ -63,7 +63,7 @@ span.bold { font-weight: bold; }
height: 350px;
top: 10px;
right: 10px;
- border: 1px dashed #990000;
+ border: 1px solid #990000;
background-color: #ffdddd;
text-align: center;
}
diff --git a/tests/cases/zindex/z-index8.html b/tests/cases/zindex/z-index8.html
index d09529d..777ec6f 100644
--- a/tests/cases/zindex/z-index8.html
+++ b/tests/cases/zindex/z-index8.html
@@ -20,7 +20,7 @@ span.bold { font-weight: bold; }
height: 200px;
top: 10px;
right: 140px;
- border: 1px dashed #990000;
+ border: 1px solid #990000;
background-color: #ffdddd;
text-align: center;
}
@@ -28,7 +28,7 @@ span.bold { font-weight: bold; }
#normdiv {
/*opacity: 0.7;*/
height: 100px;
- border: 1px dashed #999966;
+ border: 1px solid #999966;
background-color: #ffffcc;
margin: 0px 10px 0px 10px;
text-align: left;
@@ -40,7 +40,7 @@ span.bold { font-weight: bold; }
float: left;
width: 150px;
height: 200px;
- border: 1px dashed #009900;
+ border: 1px solid #009900;
background-color: #ccffcc;
text-align: center;
}
@@ -51,7 +51,7 @@ span.bold { font-weight: bold; }
float: right;
width: 150px;
height: 200px;
- border: 1px dashed #009900;
+ border: 1px solid #009900;
background-color: #ccffcc;
text-align: center;
}
@@ -63,7 +63,7 @@ span.bold { font-weight: bold; }
height: 100px;
top: 130px;
left: 100px;
- border: 1px dashed #990000;
+ border: 1px solid #990000;
background-color: #ffdddd;
text-align: center;
}
diff --git a/tests/cases/zindex/z-index9.html b/tests/cases/zindex/z-index9.html
index c43b485..7fa2761 100644
--- a/tests/cases/zindex/z-index9.html
+++ b/tests/cases/zindex/z-index9.html
@@ -16,7 +16,7 @@ span.bold { font-weight: bold; }
#normdiv {
z-index: 8;
height: 70px;
- border: 1px dashed #999966;
+ border: 1px solid #999966;
background-color: #ffffcc;
margin: 0px 50px 0px 50px;
text-align: center;
@@ -27,7 +27,7 @@ span.bold { font-weight: bold; }
height: 100px;
position: relative;
top: 30px;
- border: 1px dashed #669966;
+ border: 1px solid #669966;
background-color: #ccffcc;
margin: 0px 50px 0px 50px;
text-align: center;
@@ -39,7 +39,7 @@ span.bold { font-weight: bold; }
position: relative;
top: 15px;
left: 20px;
- border: 1px dashed #669966;
+ border: 1px solid #669966;
background-color: #ccffcc;
margin: 0px 50px 0px 50px;
text-align: center;
@@ -52,7 +52,7 @@ span.bold { font-weight: bold; }
height: 350px;
top: 10px;
left: 10px;
- border: 1px dashed #990000;
+ border: 1px solid #990000;
background-color: #ffdddd;
text-align: center;
}
@@ -64,7 +64,7 @@ span.bold { font-weight: bold; }
height: 350px;
top: 10px;
right: 10px;
- border: 1px dashed #990000;
+ border: 1px solid #990000;
background-color: #ffdddd;
text-align: center;
}