hamaji@chromium.org | e7750cb | 2010-04-30 15:46:01 +0000 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | |
| 5 | <style type="text/css" media="screen"> |
| 6 | #green { |
| 7 | background-color: green; |
| 8 | } |
yuzo@google.com | 87d4a84 | 2010-05-19 07:33:28 +0000 | [diff] [blame] | 9 | #test1 { |
hamaji@chromium.org | e7750cb | 2010-04-30 15:46:01 +0000 | [diff] [blame] | 10 | width: 100px; |
| 11 | height: 100px; |
| 12 | background-color: green; |
| 13 | } |
yuzo@google.com | 87d4a84 | 2010-05-19 07:33:28 +0000 | [diff] [blame] | 14 | .exception_test { |
| 15 | color: red; |
| 16 | } |
hamaji@chromium.org | e7750cb | 2010-04-30 15:46:01 +0000 | [diff] [blame] | 17 | /* These selectors should be ignored */ |
yuzo@google.com | 87d4a84 | 2010-05-19 07:33:28 +0000 | [diff] [blame] | 18 | #test1:first { |
hamaji@chromium.org | e7750cb | 2010-04-30 15:46:01 +0000 | [diff] [blame] | 19 | background-color: red; |
| 20 | } |
yuzo@google.com | 87d4a84 | 2010-05-19 07:33:28 +0000 | [diff] [blame] | 21 | #test1:left { |
hamaji@chromium.org | e7750cb | 2010-04-30 15:46:01 +0000 | [diff] [blame] | 22 | background-color: red; |
| 23 | } |
yuzo@google.com | 87d4a84 | 2010-05-19 07:33:28 +0000 | [diff] [blame] | 24 | #test1:right { |
hamaji@chromium.org | e7750cb | 2010-04-30 15:46:01 +0000 | [diff] [blame] | 25 | background-color: red; |
| 26 | } |
| 27 | </style> |
| 28 | <script> |
rniwa@webkit.org | 5cf7fa8 | 2012-06-15 07:38:37 +0000 | [diff] [blame] | 29 | if (window.testRunner) |
| 30 | testRunner.dumpAsText(); |
hamaji@chromium.org | e7750cb | 2010-04-30 15:46:01 +0000 | [diff] [blame] | 31 | |
| 32 | function test() |
| 33 | { |
| 34 | var expected = getComputedStyle(document.getElementById("green"), null).backgroundColor; |
yuzo@google.com | 87d4a84 | 2010-05-19 07:33:28 +0000 | [diff] [blame] | 35 | var actual = getComputedStyle(document.getElementById("test1"), null).backgroundColor; |
hamaji@chromium.org | e7750cb | 2010-04-30 15:46:01 +0000 | [diff] [blame] | 36 | var result = "PASS"; |
| 37 | if (actual != expected) |
| 38 | result = "Expected " + expected + ", but comes " + actual; |
| 39 | document.getElementById("result").innerHTML = result; |
yuzo@google.com | 87d4a84 | 2010-05-19 07:33:28 +0000 | [diff] [blame] | 40 | |
| 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.org | e7750cb | 2010-04-30 15:46:01 +0000 | [diff] [blame] | 54 | } |
| 55 | </script> |
| 56 | </head> |
| 57 | <body onload="test()"> |
| 58 | |
| 59 | <p> |
| 60 | Test case for <a href="https://bugs.webkit.org/show_bug.cgi?id=38272">SHOULD NEVER BE REACHED assertion loading forbes.com</a>. |
| 61 | Paged media related pseudo-classes should be ignored outside of @page. |
| 62 | |
| 63 | <p> |
yuzo@google.com | 87d4a84 | 2010-05-19 07:33:28 +0000 | [diff] [blame] | 64 | You should see a green box for Test 1, "Test n: PASS" for the rest. |
hamaji@chromium.org | e7750cb | 2010-04-30 15:46:01 +0000 | [diff] [blame] | 65 | |
| 66 | <div id="green"></div> |
yuzo@google.com | 87d4a84 | 2010-05-19 07:33:28 +0000 | [diff] [blame] | 67 | <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.org | e7750cb | 2010-04-30 15:46:01 +0000 | [diff] [blame] | 80 | <div id="result"></div> |
| 81 | |
| 82 | </body> |
| 83 | </html> |