-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathattr-universal-selector.html
More file actions
35 lines (32 loc) · 1013 Bytes
/
attr-universal-selector.html
File metadata and controls
35 lines (32 loc) · 1013 Bytes
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
<!DOCTYPE html>
<title>CSS Values and Units Test: attr() security limitations in universal selector </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 --some-string {
syntax: "<string>";
inherits: true;
initial-value: "empty";
}
* {
--some-string: "https://does-not-exist.test/404.png";
}
div {
--some-string: attr(data-foo);
background-image: image-set(var(--some-string));
}
</style>
<html>
<body>
<div id="attr" data-foo="https://does-not-exist.test/404.png"></div>
</body>
</html>
<script>
var elem = document.getElementById("attr");
test(() => {
assert_equals(window.getComputedStyle(elem).getPropertyValue('background-image'),
'none',
"'background-image: attr(data-foo)' with data-foo='https://does-not-exist.test/404.png'");
});
</script>