-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathfunction-container-self.html
More file actions
43 lines (41 loc) · 922 Bytes
/
Copy pathfunction-container-self.html
File metadata and controls
43 lines (41 loc) · 922 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
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<title>Custom Functions: @container can not query self</title>
<link rel="help" href="https://drafts.csswg.org/css-mixins-1/#conditional-rules">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#container, #target {
container-type: size;
}
#container {
width: 100px;
height: 100px;
}
#target {
width: 50px;
height: 50px;
}
@function --f() {
result: A;
@container (width = 100px) {
result: B;
}
@container (width = 50px) {
result: C;
}
}
#target {
--actual: --f();
}
</style>
<div id=container>
<div id=target>
</div>
</div>
<script>
test(() => {
// Even though #target is a CQ container, the @container rules should
// not evaluate against that element.
assert_equals(getComputedStyle(target).getPropertyValue('--actual'), 'B');
});
</script>