-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathcontent-computed.html
More file actions
55 lines (47 loc) · 3.1 KB
/
content-computed.html
File metadata and controls
55 lines (47 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Content Module Level 3: getComputedStyle().content</title>
<link rel="author" title="Tim Nguyen" href="https://github.com/nt1m">
<link rel="help" href="https://un5n798jx6qx6j0rmf2verhh.julianrbryant.com/css-content-3/#content-property">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/computed-testcommon.js"></script>
</head>
<body>
<!-- Note: we have to make this element 'display:none' so that it doesn't
trigger actual image loads from remote web servers when we set its
'content' property to e.g. https://un5gmtkzgjkmem4kvumj8.julianrbryant.com/picture.svg via the
scripted tests below. -->
<div id="target" style="display:none"></div>
<script>
function test_computed_value_combinations(property, specified, computed) {
test_computed_value(property, specified, computed);
test_computed_value(property, `${specified} / "alt text"`, computed ? `${computed} / "alt text"` : undefined);
}
test_computed_value_combinations("content", "open-quote");
test_computed_value_combinations("content", "close-quote");
test_computed_value_combinations("content", "no-open-quote");
test_computed_value_combinations("content", "no-close-quote");
test_computed_value_combinations("content", "counter(counter-name)");
test_computed_value_combinations("content", "counter(counter-name, counter-style)");
test_computed_value_combinations("content", "counter(counter-name, dECiMaL)", "counter(counter-name)");
test_computed_value_combinations("content", "counter(counter-name, DECIMAL)", "counter(counter-name)");
test_computed_value_combinations("content", `counters(counter-name, ".")`);
test_computed_value_combinations("content", `counters(counter-name, ".", counter-style)`);
test_computed_value_combinations("content", `counters(counter-name, ".", dECiMaL)`, `counters(counter-name, ".")`);
test_computed_value_combinations("content", `counters(counter-name, ".", DECIMAL)`, `counters(counter-name, ".")`);
test_computed_value_combinations("content", `url("https://un5gmtkzgjkmem4kvumj8.julianrbryant.com/picture.svg")`);
test_computed_value_combinations("content", `"hello"`);
test_computed_value_combinations("content", `counter(counter-name) "potato"`);
test_computed_value_combinations("content", `counters(counter-name, ".") "potato"`);
test_computed_value_combinations("content", `"(" counters(counter-name, ".", counter-style) ")"`);
test_computed_value_combinations("content", `open-quote "hello" "world" close-quote`);
test_computed_value_combinations("content", `url("https://un5gmtkzgjkmem4kvumj8.julianrbryant.com/picture.svg") "hello"`);
test_computed_value("content", "linear-gradient(to top right, red calc(10% + 2em), blue", "linear-gradient(to right top, rgb(255, 0, 0) calc(10% + 32px), rgb(0, 0, 255))");
test_computed_value("content", "radial-gradient(ellipse 50% 40% at calc(2em + 10px) 30%, red, blue)", "radial-gradient(50% 40% at 42px 30%, rgb(255, 0, 0), rgb(0, 0, 255))");
test_computed_value("content", "conic-gradient(from 1.5708rad, red 0deg, blue calc(180deg - 10deg))", "conic-gradient(from 90.0002deg, rgb(255, 0, 0) 0deg, rgb(0, 0, 255) 170deg)");
</script>
</body>
</html>