blob: a2275067f3c1afdff56089fcf8041873400826f2 [file] [log] [blame]
hamaji@chromium.orge7750cb2010-04-30 15:46:01 +00001<!DOCTYPE html>
2<html>
3<head>
4
5<style type="text/css" media="screen">
6 #green {
7 background-color: green;
8 }
yuzo@google.com87d4a842010-05-19 07:33:28 +00009 #test1 {
hamaji@chromium.orge7750cb2010-04-30 15:46:01 +000010 width: 100px;
11 height: 100px;
12 background-color: green;
13 }
yuzo@google.com87d4a842010-05-19 07:33:28 +000014 .exception_test {
15 color: red;
16 }
hamaji@chromium.orge7750cb2010-04-30 15:46:01 +000017 /* These selectors should be ignored */
yuzo@google.com87d4a842010-05-19 07:33:28 +000018 #test1:first {
hamaji@chromium.orge7750cb2010-04-30 15:46:01 +000019 background-color: red;
20 }
yuzo@google.com87d4a842010-05-19 07:33:28 +000021 #test1:left {
hamaji@chromium.orge7750cb2010-04-30 15:46:01 +000022 background-color: red;
23 }
yuzo@google.com87d4a842010-05-19 07:33:28 +000024 #test1:right {
hamaji@chromium.orge7750cb2010-04-30 15:46:01 +000025 background-color: red;
26 }
27</style>
28<script>
rniwa@webkit.org5cf7fa82012-06-15 07:38:37 +000029 if (window.testRunner)
30 testRunner.dumpAsText();
hamaji@chromium.orge7750cb2010-04-30 15:46:01 +000031
32 function test()
33 {
34 var expected = getComputedStyle(document.getElementById("green"), null).backgroundColor;
yuzo@google.com87d4a842010-05-19 07:33:28 +000035 var actual = getComputedStyle(document.getElementById("test1"), null).backgroundColor;
hamaji@chromium.orge7750cb2010-04-30 15:46:01 +000036 var result = "PASS";
37 if (actual != expected)
38 result = "Expected " + expected + ", but comes " + actual;
39 document.getElementById("result").innerHTML = result;
yuzo@google.com87d4a842010-05-19 07:33:28 +000040
41 var invalidSelectors = [":first", ":left", ":right", "::first", "::left", "::right",
42 ".login-popup:first", ".login-popup:left", ".login-popup:right", ".login-popup::first", ".login-popup::left", ".login-popup::right"];
43 for (var testId = 2; testId <= 13; testId++) {
44 var element = document.getElementById("test" + testId);
45 var invalidSelector = invalidSelectors[testId - 2];
46 try {
47 document.querySelectorAll(invalidSelector);
48 element.innerHTML = "Test " + testId + ": FAIL";
49 } catch (e) {
50 element.innerHTML = "Test " + testId + ": PASS";
51 element.style.color = "green";
52 }
53 }
hamaji@chromium.orge7750cb2010-04-30 15:46:01 +000054 }
55</script>
56</head>
57<body onload="test()">
58
59<p>
60Test case for <a href="https://bugs.webkit.org/show_bug.cgi?id=38272">SHOULD NEVER BE REACHED assertion loading forbes.com</a>.
61Paged media related pseudo-classes should be ignored outside of @page.
62
63<p>
yuzo@google.com87d4a842010-05-19 07:33:28 +000064You should see a green box for Test 1, "Test n: PASS" for the rest.
hamaji@chromium.orge7750cb2010-04-30 15:46:01 +000065
66<div id="green"></div>
yuzo@google.com87d4a842010-05-19 07:33:28 +000067<div id="test1"></div>
68<div id="test2" class="exception_test">Test 2: Didn't run</div>
69<div id="test3" class="exception_test">Test 3: Didn't run</div>
70<div id="test4" class="exception_test">Test 4: Didn't run</div>
71<div id="test5" class="exception_test">Test 5: Didn't run</div>
72<div id="test6" class="exception_test">Test 6: Didn't run</div>
73<div id="test7" class="exception_test">Test 7: Didn't run</div>
74<div id="test8" class="exception_test">Test 8: Didn't run</div>
75<div id="test9" class="exception_test">Test 9: Didn't run</div>
76<div id="test10" class="exception_test">Test 10: Didn't run</div>
77<div id="test11" class="exception_test">Test 11: Didn't run</div>
78<div id="test12" class="exception_test">Test 12: Didn't run</div>
79<div id="test13" class="exception_test">Test 13: Didn't run</div>
hamaji@chromium.orge7750cb2010-04-30 15:46:01 +000080<div id="result"></div>
81
82</body>
83</html>