|
| 1 | +<!doctype html> |
| 2 | +<meta charset="utf-8"> |
| 3 | +<title>CSSOM: getComputedStyle mustn't support other pseudo-elements</title> |
| 4 | +<link rel="help" href="https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle"> |
| 5 | +<script src=/resources/testharness.js></script> |
| 6 | +<script src=/resources/testharnessreport.js></script> |
| 7 | +<style> |
| 8 | + #test { color: orange; } |
| 9 | + |
| 10 | + #test p { color: rgb(0, 0, 10); } |
| 11 | + #test p::first-line { color: rgb(0, 0, 100); } |
| 12 | + #test p::first-letter { color: rgb(0, 200, 200); } |
| 13 | + |
| 14 | + #test ol { color: rgb(1, 0, 10); } |
| 15 | + #test li { color: rgb(1, 0, 100); } |
| 16 | + #test li::marker { color: rgb(1, 200, 200); } |
| 17 | + |
| 18 | + #test input { color: rgb(2, 0, 10); } |
| 19 | + #test input::placeholder { color: rgb(2, 200, 200); } |
| 20 | +</style> |
| 21 | +<div id="test"> |
| 22 | + <p>Filler Text</p> |
| 23 | + <ol> |
| 24 | + <li>Filler Text</li> |
| 25 | + </ol> |
| 26 | + <input placeholder="Filler Text"> |
| 27 | +</div> |
| 28 | +<script> |
| 29 | +["::first-line", ":first-line"].forEach(function(pseudo) { |
| 30 | + test(function() { |
| 31 | + var p = document.querySelector('#test p'); |
| 32 | + assert_equals(getComputedStyle(p, pseudo).color, "rgb(0, 0, 10)"); |
| 33 | + }, "Right element color is returned for " + pseudo); |
| 34 | +}); |
| 35 | +["::first-letter", ":first-letter"].forEach(function(pseudo) { |
| 36 | + test(function() { |
| 37 | + var p = document.querySelector('#test p'); |
| 38 | + assert_equals(getComputedStyle(p, pseudo).color, "rgb(0, 0, 10)"); |
| 39 | + }, "Right element color is returned for " + pseudo); |
| 40 | +}); |
| 41 | +test(function() { |
| 42 | + var li = document.querySelector('#test li'); |
| 43 | + assert_equals(getComputedStyle(li, "::marker").color, "rgb(1, 0, 100)"); |
| 44 | +}, "Right element color is returned for ::marker"); |
| 45 | +test(function() { |
| 46 | + var input = document.querySelector('#test input'); |
| 47 | + assert_equals(getComputedStyle(input, "::placeholder").color, "rgb(2, 0, 10)"); |
| 48 | +}, "Right element color is returned for ::placeholder"); |
| 49 | +</script> |
0 commit comments