Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
            
- /css/css-contain/contain-style-dynamic-002.html - WPT Dashboard Interop Dashboard
 
 
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="match" href="contain-style-dynamic-002-ref.html">
<style>
ol {
  list-style: inside decimal;
  padding-inline-start: 1em;
  counter-reset: c 0;
}
li {
  counter-increment: c 1;
}
div {
  contain: style;
}
:is(ol, li, div) {
  padding-left: 1em;
}
:is(ol, li, div)::before {
  content: "[::before=" counters(c, ".") "]";
}
:is(ol, li, div)::after {
  content: "[::after=" counters(c, ".") "]";
}
div::before {
  color: red;
}
</style>
<ol>
  <li></li>
  <div>
    <li></li>
  </div>
  <li></li>
</ol>
<script>
var div = document.querySelector("div");
div.getBoundingClientRect();
div.style.display = "none";
div.getBoundingClientRect();
div.style.display = "";
</script>