diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /layout/style/test/test_selectors_on_anonymous_content.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/style/test/test_selectors_on_anonymous_content.html')
-rw-r--r-- | layout/style/test/test_selectors_on_anonymous_content.html | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/layout/style/test/test_selectors_on_anonymous_content.html b/layout/style/test/test_selectors_on_anonymous_content.html new file mode 100644 index 000000000..a4975f6b8 --- /dev/null +++ b/layout/style/test/test_selectors_on_anonymous_content.html @@ -0,0 +1,78 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test for CSS Selectors</title> + <!-- + Separate from test_selectors.html so we don't need to deal with + waiting for the binding document to load. + --> + <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"> + + #display { -moz-binding: url(xbl_bindings.xml#onedivchild); } + + </style> +</head> +<body onload="run()"> +<div id="display"></div> +<pre id="test"> +<script class="testbody" type="text/javascript"> + +SimpleTest.waitForExplicitFinish(); + +function run() { + + function setup_style() { + var style_elem = document.createElement("style"); + style_elem.setAttribute("type", "text/css"); + document.getElementsByTagName("head")[0].appendChild(style_elem); + var style_text = document.createTextNode(""); + style_elem.appendChild(style_text); + return style_text; + } + + var style_text = setup_style(); + + var gCounter = 0; + + function test_selector(selector, matches_docdiv, matches_anondiv) + { + var zi = ++gCounter; + style_text.data = selector + "{ z-index: " + zi + " }"; + + var doc_div = document.getElementById("display"); + var anon_div = SpecialPowers.wrap(document).getAnonymousNodes(doc_div)[0]; + var should_match = []; + var should_not_match = []; + (matches_docdiv ? should_match : should_not_match).push(doc_div); + (matches_anondiv ? should_match : should_not_match).push(anon_div); + + for (var i = 0; i < should_match.length; ++i) { + var e = should_match[i]; + is(SpecialPowers.wrap(window).getComputedStyle(e, "").zIndex, String(zi), + "element matched " + selector); + } + for (var i = 0; i < should_not_match.length; ++i) { + var e = should_not_match[i]; + is(SpecialPowers.wrap(window).getComputedStyle(e, "").zIndex, "auto", + "element did not match " + selector); + } + + style_text.data = ""; + } + + // Test that the root of an XBL1 anonymous content subtree doesn't + // match :nth-child(). + test_selector("div.anondiv", false, true); + test_selector("div:nth-child(odd)", true, false); + test_selector("div:nth-child(even)", false, false); + + SimpleTest.finish(); +} + +</script> +</pre> +</body> +</html> + |