Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/dom/elements/global-attributes/dir-shadow-42.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>[dir] and shadow slots: dir=ltr on a div in the shadow tree, dir=rtl on the shadow host, no slotted text in the light or dark trees</title>
<link rel="author" title="Eric Meyer" href="mailto:emeyer@igalia.com">
<link rel="author" title="L. David Baron" href="mailto:dbaron@chromium.org">
<link rel="match" href="dir-shadow-42-ref.html">
<style type="text/css">
body {width: 600px;}
#host {border: 1px solid gray; margin: 1em; padding: 0.25em;}
span {border: 1px solid silver;}
</style>
<script src="dir-shadow-utils.js"></script>
</head>
<body>
<p>`dir=ltr` on a div in the shadow tree, `dir=rtl` on the shadow host, no slotted text in the light or dark trees</p>
<div id="host" dir="rtl"><span slot="x1"></span></div>
<p id="result">The HTML direction / computed CSS `direction` value is: </p>
<script type="text/javascript">
let root = host.attachShadow({mode:"open"});
root.innerHTML = `<div dir="ltr"><slot dir="auto" name="x1"></slot></div>`;
result.innerHTML += html_direction(root.querySelector("div[dir=ltr]").firstChild) + " / " + getComputedStyle(root.querySelector("div[dir=ltr]").firstChild).direction + " (on the " + root.querySelector("div[dir=ltr]").firstChild.localName + ').';
</script>
</body>
</html>