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
|
<!DOCTYPE html>
<meta charset="utf-8">
<title>Container Relative Units: ineligible container</title>
<link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-lengths">
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
<style>
#grandparent, #parent { container-type: size; }
#grandparent { width: 300px; height: 250px; }
#parent { width: 200px; height: 150px; }
#target { width: 10cqw; height: 10cqh; }
</style>
<div id="log"></div>
<div id="grandparent">
<div id="parent">
<div id="target"></div>
</div>
</div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/cq-testcommon.js"></script>
<script>
setup(() => assert_implements_container_queries());
const cases = {
"/* basic */": [20, 15],
"display: table": [30, 25],
"display: table-cell": [30, 25],
"display: inline": [30, 25],
"display: contents": [30, 25],
"display: none": [30, 25],
"container-type: normal": [30, 25],
"container-type: inline-size": [20, 25],
"container-type: inline-size; writing-mode: vertical-lr": [30, 15],
};
const parent = document.getElementById("parent");
const target = document.getElementById("target");
const cs = getComputedStyle(target);
for (let [style, [width, height]] of Object.entries(cases)) {
test(() => {
parent.style.cssText = style;
assert_equals(cs.width, width + "px", "width");
assert_equals(cs.height, height + "px", "height");
}, style);
}
</script>
|