summaryrefslogtreecommitdiffstats
path: root/layout/style/test/test_bug534804.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /layout/style/test/test_bug534804.html
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/style/test/test_bug534804.html')
-rw-r--r--layout/style/test/test_bug534804.html89
1 files changed, 89 insertions, 0 deletions
diff --git a/layout/style/test/test_bug534804.html b/layout/style/test/test_bug534804.html
new file mode 100644
index 0000000000..0b60e6d89c
--- /dev/null
+++ b/layout/style/test/test_bug534804.html
@@ -0,0 +1,89 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=534804
+-->
+<head>
+ <title>Test for Bug 534804</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <style type="text/css" id="styleone"> </style>
+ <style type="text/css" id="styletwo"> </style>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=534804">Mozilla Bug 534804</a>
+<p id="display"></p>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 534804 **/
+
+var styleone = document.getElementById("styleone");
+var styletwo = document.getElementById("styletwo");
+var display = document.getElementById("display");
+
+run1();
+styletwo.firstChild.data = "#e > span:nth-child(2n+1) { color: green }";
+run1();
+styletwo.firstChild.data = "#e > span:first-child { color: green }";
+run1();
+styletwo.firstChild.data = "#e > span:nth-last-child(2n+1) { color: green }";
+run1();
+styletwo.firstChild.data = "#e > span:last-child { color: green }";
+run1();
+
+function run1()
+{
+ function identity(bool) { return bool; }
+ function inverse(bool) { return !bool; }
+ function always_false(bool) { return false; }
+ run2("#e:empty + span", identity, always_false);
+ run2("#e:empty ~ span", identity, identity);
+ run2("#e:not(:empty) + span", inverse, always_false);
+ run2("#e:not(:empty) ~ span", inverse, inverse);
+}
+
+function run2(sel, next_sibling_rule, later_sibling_rule)
+{
+ styleone.firstChild.data = sel + " { text-decoration: underline }";
+
+ // Rebuild the subtree every time.
+ var span1 = document.createElement("span");
+ span1.id = "e";
+ var span2 = document.createElement("span");
+ var span3 = document.createElement("span");
+ display.appendChild(span1);
+ display.appendChild(span2);
+ display.appendChild(span3);
+
+ function td(e) { return getComputedStyle(e, "").textDecorationLine; }
+
+ function check(desc, isempty) {
+ is(td(span2), next_sibling_rule(isempty) ? "underline" : "none",
+ "match of next sibling in state " + desc);
+ is(td(span3), later_sibling_rule(isempty) ? "underline" : "none",
+ "match of next sibling in state " + desc);
+ }
+
+ check("initially empty", true);
+ var kid = document.createElement("span");
+ span1.appendChild(kid);
+ check("after append", false);
+ span1.removeChild(kid);
+ check("after remove", true);
+ span1.appendChild(document.createTextNode(""));
+ span1.appendChild(document.createComment("a comment"));
+ span1.appendChild(document.createTextNode(""));
+ check("after append of insignificant children", true);
+ span1.insertBefore(kid, span1.childNodes[1]);
+ check("after insert", false);
+
+ display.removeChild(span1);
+ display.removeChild(span2);
+ display.removeChild(span3);
+}
+
+</script>
+</pre>
+</body>
+</html>