pseudo-elements-013.html (1540B)
1 <!doctype html> 2 <title>@container: originating element container for highlight pseudo elements</title> 3 <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#container-queries"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="support/cq-testcommon.js"></script> 7 <style> 8 #target { container-type: inline-size; } 9 #target::highlight(foo) { 10 text-decoration-line: underline; 11 text-decoration-thickness: 0px; 12 } 13 @container (width >= 300px) { 14 #target::highlight(foo) { 15 text-decoration-line: underline; 16 text-decoration-thickness: 10cqw; 17 } 18 #target::highlight(bar) { 19 text-decoration-line: underline; 20 text-decoration-thickness: 10cqw; 21 } 22 } 23 </style> 24 <div id="outer" style="width: 200px"> 25 <div id="target"></div> 26 </div> 27 <script> 28 setup(() => assert_implements_size_container_queries()); 29 30 test(() => { 31 assert_equals(getComputedStyle(target, "::highlight(foo)").textDecorationThickness, "0px"); 32 }, `Initial text-decoration-thickness for highlight pseudo`); 33 34 outer.style.width = "300px"; 35 36 test(() => { 37 assert_equals(getComputedStyle(target, "::highlight(foo)").textDecorationThickness, "30px"); 38 }, `text-decoration-thickness for highlight pseudo depending on container`); 39 test(() => { 40 assert_equals(getComputedStyle(target, "::highlight(bar)").textDecorationThickness, "30px"); 41 }, `text-decoration-thickness for highlight pseudo depending on container only defined in a query`); 42 </script>