From 00555cf1efddfed5877811d8a03a326f9943ab06 Mon Sep 17 00:00:00 2001 From: Niklas von Hertzen Date: Sat, 21 Sep 2019 21:12:36 -0700 Subject: [PATCH] fix: nested z-index ordering (#2011) * fix zindex bug * test: add z-index reftest for #1978 * fix: z-index ordering early exit --- src/render/stacking-context.ts | 5 ++ tests/reftests/zindex/z-index19.html | 71 ++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 tests/reftests/zindex/z-index19.html diff --git a/src/render/stacking-context.ts b/src/render/stacking-context.ts index 7136709..32497e3 100644 --- a/src/render/stacking-context.ts +++ b/src/render/stacking-context.ts @@ -104,8 +104,11 @@ const parseStackTree = ( parentStack.negativeZIndex.some((current, i) => { if (order > current.element.container.styles.zIndex.order) { index = i; + return false; + } else if (index > 0) { return true; } + return false; }); parentStack.negativeZIndex.splice(index, 0, stack); @@ -114,6 +117,8 @@ const parseStackTree = ( parentStack.positiveZIndex.some((current, i) => { if (order > current.element.container.styles.zIndex.order) { index = i + 1; + return false; + } else if (index > 0) { return true; } diff --git a/tests/reftests/zindex/z-index19.html b/tests/reftests/zindex/z-index19.html new file mode 100644 index 0000000..0db6949 --- /dev/null +++ b/tests/reftests/zindex/z-index19.html @@ -0,0 +1,71 @@ + + + + + z-index19 + + + + +
+
+
+
+
+
+
+
+ +