104 lines
3.0 KiB
HTML
104 lines
3.0 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=73586
|
|
-->
|
|
<head>
|
|
<title>Test for Bug 73586</title>
|
|
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
<style type="text/css">
|
|
|
|
span { background: white; color: black; border: medium solid black; }
|
|
|
|
span:first-child { background: lime; }
|
|
span:last-child { color: green; }
|
|
span:only-child { border: medium solid green; }
|
|
span:-moz-first-node { text-decoration: underline; }
|
|
span:-moz-last-node { visibility: hidden; }
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=73586">Mozilla Bug 73586</a>
|
|
<p id="display">x<span></span><span></span></p>
|
|
<div id="content" style="display: none">
|
|
|
|
</div>
|
|
<pre id="test">
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
/** Test for Bug 73586 **/
|
|
|
|
const GREEN = "rgb(0, 128, 0)";
|
|
const LIME = "rgb(0, 255, 0)";
|
|
const BLACK = "rgb(0, 0, 0)";
|
|
const WHITE = "rgb(255, 255, 255)";
|
|
|
|
var p = document.getElementById("display");
|
|
function cs(elt) { return getComputedStyle(elt, ""); }
|
|
|
|
function check_children() {
|
|
var len = p.childNodes.length;
|
|
var elts = 0;
|
|
var i, elt, child;
|
|
for (i = 0; i < len; ++i) {
|
|
if (p.childNodes[i].nodeType == Node.ELEMENT_NODE)
|
|
++elts;
|
|
}
|
|
|
|
elt = 0;
|
|
for (i = 0; i < len; ++i) {
|
|
child = p.childNodes[i];
|
|
if (child.NodeType != Node.ELEMENT_NODE)
|
|
continue;
|
|
is(cs(child).backgroundColor, (elt == 0) ? LIME : WHITE,
|
|
"child " + i + " should " + ((elt == 0) ? "" : "NOT ") +
|
|
" match :first-child");
|
|
is(cs(child).color, (elt == elts - 1) ? GREEN : BLACK,
|
|
"child " + i + " should " + ((elt == elts - 1) ? "" : "NOT ") +
|
|
" match :last-child");
|
|
is(cs(child).borderTopColor, (elts == 1) ? GREEN : BLACK,
|
|
"child " + i + " should " + ((elts == 1) ? "" : "NOT ") +
|
|
" match :only-child");
|
|
|
|
is(cs(child).textDecoration, (i == 0) ? "underline" : "none",
|
|
"child " + i + " should " + ((i == 0) ? "" : "NOT ") +
|
|
" match :-moz-first-node");
|
|
is(cs(child).visibilty, (i == len - 1) ? "hidden" : "visible",
|
|
"child " + i + " should " + ((i == len - 1) ? "" : "NOT ") +
|
|
" match :-moz-last-node");
|
|
|
|
++elt;
|
|
}
|
|
}
|
|
|
|
check_children();
|
|
var text = p.removeChild(p.childNodes[0]);
|
|
check_children();
|
|
var span = p.removeChild(p.childNodes[0]);
|
|
check_children();
|
|
p.appendChild(span);
|
|
check_children();
|
|
p.removeChild(span);
|
|
check_children();
|
|
p.insertBefore(span, p.childNodes[0]);
|
|
check_children();
|
|
p.removeChild(span);
|
|
check_children();
|
|
p.insertBefore(span, null);
|
|
check_children();
|
|
p.appendChild(document.createElement("span"));
|
|
check_children();
|
|
p.insertBefore(document.createElement("span"), p.childNodes[2]);
|
|
check_children();
|
|
p.appendChild(text);
|
|
check_children();
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|
|
|