| <!doctype html> |
| <title>CSS Container Queries Test: SVG root as a size query container</title> |
| <link rel="help" href="https://drafts.csswg.org/css-contain-3/#size-container"> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.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> |
| let 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> |