-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathattr-security-animation.html
More file actions
51 lines (46 loc) · 1.21 KB
/
attr-security-animation.html
File metadata and controls
51 lines (46 loc) · 1.21 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
<!DOCTYPE html>
<title>CSS Values and Units Test: attr() security limitations</title>
<link rel="help" href="https://drafts.csswg.org/css-values-5/#attr-security">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
@property --s {
syntax: "<string>";
inherits: false;
initial-value: "x";
}
#attr {
--s: attr(href);
animation: 1s anim linear;
background-image: image-set(var(--s));
}
@keyframes anim {
from {
--s: "x";
}
to {
--s: attr(href);
}
}
</style>
<html>
<body>
<div id="attr" href="https://does-not-exist.test/404.png">div</div>
</body>
</html>
<script>
test(() => {
// during animation
document.getAnimations().forEach(anim => {
anim.currentTime = 600;
});
var elem = document.getElementById("attr");
assert_equals(window.getComputedStyle(elem).getPropertyValue("background-image"), 'none');
// after animation
document.getAnimations().forEach(anim => {
anim.currentTime = 3000;
});
var elem = document.getElementById("attr");
assert_equals(window.getComputedStyle(elem).getPropertyValue("background-image"), 'none');
});
</script>