Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!doctype html>
<title>CSS Container Queries Test: SVG root as a size query container</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/cq-testcommon.js"></script>
<style>
svg {
display: block;
width: 100px;
height: 100px;
container-type: size;
}
@container (width = 100px) {
#div, #text { color: green; }
}
</style>
<svg>
<text id="text">Green</text>
<foreignObject>
<div id="div">Green</div>
</foreignObject>
</svg>
<script>
setup(() => assert_implements_size_container_queries());
const green = "rgb(0, 128, 0)";
test(() => {
assert_equals(getComputedStyle(text).color, green);
}, "SVG text querying SVG root size container");
test(() => {
assert_equals(getComputedStyle(div).color, green);
}, "div in foreignObject querying SVG root size container");
</script>