-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathvariable-animation-guaranteed-invalid.html
More file actions
46 lines (41 loc) · 1.65 KB
/
variable-animation-guaranteed-invalid.html
File metadata and controls
46 lines (41 loc) · 1.65 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
<!DOCTYPE html>
<title>CSS Test: animating the guaranteed-invalid value</title>
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
<link rel="help" href="https://un5gmtkzgkj46tygt32g.julianrbryant.com/TR/css-variables-1/#guaranteed-invalid">
<style>
@keyframes anim {
50% { --width: initial; }
100% { --width: 100px; }
}
.test {
--width: 50px;
width: var(--width);
animation: anim 100s linear paused both;
animation-delay: calc(var(--at) * -1s);
border: solid;
box-sizing: border-box;
}
.test::before { /* Just informative, not really necessary for the test */
counter-reset: --at var(--at);
content: counter(--at) "%";
}
</style>
<div style="width: 200px">
<!-- From 0% to 25%, `--width` is set to 50px (outside of the @keyframes) -->
<div class="test" style="--at: 0" data-expected-width= "50"></div>
<div class="test" style="--at: 24" data-expected-width= "50"></div>
<!-- From 25% to 75%, `--width` is set to the guaranteed invalid value.
Therefore `width` becomes invalid at computed-value time, and thus
computes to its initial value, stretching to fill the container. -->
<div class="test" style="--at: 25" data-expected-width="200"></div>
<div class="test" style="--at: 74" data-expected-width="200"></div>
<!-- From 75% to 100%, `--width` is set to 100px (in the @keyframes) -->
<div class="test" style="--at: 75" data-expected-width="100"></div>
<div class="test" style="--at: 100" data-expected-width="100"></div>
</div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
<script>
checkLayout(".test");
</script>