Bug 458861. Validate TrueType headers before activating downloaded font. r=roc, sr...
[wine-gecko.git] / layout / style / test / test_selectors_on_anonymous_content.html
blobac323b78529356fd8a4792d495fe301e7ba0b9af
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <title>Test for CSS Selectors</title>
5 <!--
6 Separate from test_selectors.html so we don't need to deal with
7 waiting for the binding document to load.
8 -->
9 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
10 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
12 <style type="text/css">
14 #display { -moz-binding: url(xbl_bindings.xml#onedivchild); }
16 </style>
17 </head>
18 <body onload="run()">
19 <div id="display"></div>
20 <pre id="test">
21 <script class="testbody" type="text/javascript">
23 SimpleTest.waitForExplicitFinish();
25 function run() {
27 function setup_style() {
28 var style_elem = document.createElement("style");
29 style_elem.setAttribute("type", "text/css");
30 document.getElementsByTagName("head")[0].appendChild(style_elem);
31 var style_text = document.createTextNode("");
32 style_elem.appendChild(style_text);
33 return style_text;
36 var style_text = setup_style();
38 var gCounter = 0;
40 function test_selector(selector, matches_docdiv, matches_anondiv)
42 var zi = ++gCounter;
43 style_text.data = selector + "{ z-index: " + zi + " }";
45 var doc_div = document.getElementById("display");
46 var anon_div = document.getAnonymousNodes(doc_div)[0];
47 var should_match = [];
48 var should_not_match = [];
49 (matches_docdiv ? should_match : should_not_match).push(doc_div);
50 (matches_anondiv ? should_match : should_not_match).push(anon_div);
52 for (var i = 0; i < should_match.length; ++i) {
53 var e = should_match[i];
54 is(getComputedStyle(e, "").zIndex, zi,
55 "element matched " + selector);
57 for (var i = 0; i < should_not_match.length; ++i) {
58 var e = should_not_match[i];
59 is(getComputedStyle(e, "").zIndex, "auto",
60 "element did not match " + selector);
63 style_text.data = "";
66 // Test that the root of an XBL1 anonymous content subtree doesn't
67 // match :nth-child().
68 test_selector("div.anondiv", false, true);
69 test_selector("div:nth-child(odd)", true, false);
70 test_selector("div:nth-child(even)", false, false);
72 SimpleTest.finish();
75 </script>
76 </pre>
77 </body>
78 </html>