contain-style-dynamic-002.html (879B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1934755"> 4 <link rel="help" href="https://drafts.csswg.org/css-contain/#containment-style"> 5 <link rel="match" href="contain-style-dynamic-002-ref.html"> 6 <style> 7 ol { 8 list-style: inside decimal; 9 padding-inline-start: 1em; 10 counter-reset: c 0; 11 } 12 li { 13 counter-increment: c 1; 14 } 15 div { 16 contain: style; 17 } 18 :is(ol, li, div) { 19 padding-left: 1em; 20 } 21 :is(ol, li, div)::before { 22 content: "[::before=" counters(c, ".") "]"; 23 } 24 :is(ol, li, div)::after { 25 content: "[::after=" counters(c, ".") "]"; 26 } 27 div::before { 28 color: red; 29 } 30 </style> 31 <ol> 32 <li></li> 33 <div> 34 <li></li> 35 </div> 36 <li></li> 37 </ol> 38 <script> 39 var div = document.querySelector("div"); 40 div.getBoundingClientRect(); 41 div.style.display = "none"; 42 div.getBoundingClientRect(); 43 div.style.display = ""; 44 </script>