Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
            
- /shadow-dom/directionality-002.tentative.html - WPT Dashboard Interop Dashboard
 
 
<!doctype html>
<title>Directionality is properly computed for slotted children</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="match" href="directionality-002-ref.html">
<style>
  .slotted {
    width: 100px;
    height: 100px;
    background: red;
  }
  .slotted:dir(rtl) {
    background: green;
  }
</style>
<body dir="rtl">
<script>
  let root = document.createElement("div")
  let slotted = document.createElement("div");
  slotted.className = "slotted";
  root.appendChild(slotted);
  root.attachShadow({ mode: "open" }).appendChild(document.createElement("slot"));
  document.body.appendChild(root);
</script>